Fixed an NPE (apparently harmless) for a certain connection
teardown ordering and added some logging just to be sure the channels are getting closed. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7153 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
50465e37b3
commit
d3364b4622
@ -318,7 +318,13 @@ public class SelectorKernel extends AbstractKernel
|
|||||||
|
|
||||||
protected void cancel( NioEndpoint p ) throws IOException
|
protected void cancel( NioEndpoint p ) throws IOException
|
||||||
{
|
{
|
||||||
|
log.log( Level.INFO, "Closing endpoint:{0}.", p );
|
||||||
SelectionKey key = endpointKeys.remove(p);
|
SelectionKey key = endpointKeys.remove(p);
|
||||||
|
if( key == null ) {
|
||||||
|
log.log( Level.INFO, "Endpoint already closed:{0}.", p );
|
||||||
|
return; // already closed it
|
||||||
|
}
|
||||||
|
|
||||||
SocketChannel c = (SocketChannel)key.channel();
|
SocketChannel c = (SocketChannel)key.channel();
|
||||||
|
|
||||||
// Note: key.cancel() is specifically thread safe. One of
|
// Note: key.cancel() is specifically thread safe. One of
|
||||||
@ -332,6 +338,7 @@ public class SelectorKernel extends AbstractKernel
|
|||||||
protected void cancel( SelectionKey key, SocketChannel c ) throws IOException
|
protected void cancel( SelectionKey key, SocketChannel c ) throws IOException
|
||||||
{
|
{
|
||||||
NioEndpoint p = (NioEndpoint)key.attachment();
|
NioEndpoint p = (NioEndpoint)key.attachment();
|
||||||
|
log.log( Level.INFO, "Closing channel endpoint:{0}.", p );
|
||||||
endpointKeys.remove(p);
|
endpointKeys.remove(p);
|
||||||
|
|
||||||
key.cancel();
|
key.cancel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user