This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 9b91bc7 Cleanup according to current object names, no change 9b91bc7 is described below commit 9b91bc78a5492c21709b840f8b4ad8030d3fb2f4 Author: remm <r...@apache.org> AuthorDate: Mon Apr 15 23:40:54 2019 +0200 Cleanup according to current object names, no change --- java/org/apache/tomcat/util/net/NioEndpoint.java | 43 +++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 97bd44a..7a9e708 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -676,24 +676,27 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> addEvent(r); } - public NioSocketWrapper cancelledKey(SelectionKey key) { - NioSocketWrapper ka = null; + public NioSocketWrapper cancelledKey(SelectionKey sk) { + NioSocketWrapper socketWrapper = null; try { - if ( key == null ) return null;//nothing to do - ka = (NioSocketWrapper) key.attach(null); - if (ka != null) { + if (sk == null) { + // Nothing to do + return null; + } + socketWrapper = (NioSocketWrapper) sk.attach(null); + if (socketWrapper != null) { // If attachment is non-null then there may be a current // connection with an associated processor. - getHandler().release(ka); + getHandler().release(socketWrapper); } - if (key.isValid()) key.cancel(); + if (sk.isValid()) sk.cancel(); // If it is available, close the NioChannel first which should // in turn close the underlying SocketChannel. The NioChannel // needs to be closed first, if available, to ensure that TLS // connections are shut down cleanly. - if (ka != null) { + if (socketWrapper != null) { try { - ka.getSocket().close(true); + socketWrapper.getSocket().close(true); } catch (Exception e){ if (log.isDebugEnabled()) { log.debug(sm.getString( @@ -703,9 +706,9 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> } // The SocketChannel is also available via the SelectionKey. If // it hasn't been closed in the block above, close it now. - if (key.channel().isOpen()) { + if (sk.channel().isOpen()) { try { - key.channel().close(); + sk.channel().close(); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug(sm.getString( @@ -714,22 +717,24 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> } } try { - if (ka != null && ka.getSendfileData() != null - && ka.getSendfileData().fchannel != null - && ka.getSendfileData().fchannel.isOpen()) { - ka.getSendfileData().fchannel.close(); + if (socketWrapper != null && socketWrapper.getSendfileData() != null + && socketWrapper.getSendfileData().fchannel != null + && socketWrapper.getSendfileData().fchannel.isOpen()) { + socketWrapper.getSendfileData().fchannel.close(); } } catch (Exception ignore) { } - if (ka != null) { + if (socketWrapper != null) { countDownConnection(); - ka.closed = true; + socketWrapper.closed = true; } } catch (Throwable e) { ExceptionUtils.handleThrowable(e); - if (log.isDebugEnabled()) log.error("",e); + if (log.isDebugEnabled()) { + log.error("", e); + } } - return ka; + return socketWrapper; } /** --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org