[tomcat] branch master updated: Remove reused reference to NioChannel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch master updated: Remove reused reference to NioChannel

remm
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 2883d5c  Remove reused reference to NioChannel
2883d5c is described below

commit 2883d5c6403bb17ea8c6112e5ed72170a38ef84b
Author: remm <[hidden email]>
AuthorDate: Wed Nov 25 13:56:52 2020 +0100

    Remove reused reference to NioChannel
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index ab2766b..0f71519 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1134,8 +1134,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
 
         private int fillReadBuffer(boolean block, ByteBuffer buffer) throws IOException {
             int n = 0;
-            NioChannel socket = getSocket();
-            if (socket == NioChannel.CLOSED_NIO_CHANNEL) {
+            if (getSocket() == NioChannel.CLOSED_NIO_CHANNEL) {
                 throw new ClosedChannelException();
             }
             if (block) {
@@ -1152,7 +1151,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                             throw new SocketTimeoutException();
                         }
                     }
-                    n = socket.read(buffer);
+                    n = getSocket().read(buffer);
                     if (n == -1) {
                         throw new EOFException();
                     } else if (n == 0) {
@@ -1176,7 +1175,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                     }
                 } while (n == 0); // TLS needs to loop as reading zero application bytes is possible
             } else {
-                n = socket.read(buffer);
+                n = getSocket().read(buffer);
                 if (n == -1) {
                     throw new EOFException();
                 }
@@ -1188,8 +1187,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
         @Override
         protected void doWrite(boolean block, ByteBuffer buffer) throws IOException {
             int n = 0;
-            NioChannel socket = getSocket();
-            if (socket == NioChannel.CLOSED_NIO_CHANNEL) {
+            if (getSocket() == NioChannel.CLOSED_NIO_CHANNEL) {
                 throw new ClosedChannelException();
             }
             if (block) {
@@ -1206,7 +1204,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                             throw new SocketTimeoutException();
                         }
                     }
-                    n = socket.write(buffer);
+                    n = getSocket().write(buffer);
                     if (n == -1) {
                         throw new EOFException();
                     } else if (n == 0) {
@@ -1239,7 +1237,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                 // write registration.
             } else {
                 do {
-                    n = socket.write(buffer);
+                    n = getSocket().write(buffer);
                     if (n == -1) {
                         throw new EOFException();
                     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]