You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/09 20:03:10 UTC

[19/50] httpcomponents-core git commit: Accept as many as incoming connections as possible from the listener's server channel

Accept as many as incoming connections as possible from the listener's server channel

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.2.x@1444383 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/b54b88a5
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b54b88a5
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b54b88a5

Branch: refs/heads/4.2.x
Commit: b54b88a5dc01c8c285f475ae165752c419ba8455
Parents: 2dac292
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sat Feb 9 16:07:31 2013 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Feb 9 16:07:31 2013 +0000

----------------------------------------------------------------------
 .../nio/reactor/DefaultListeningIOReactor.java  | 24 +++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b54b88a5/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
index 8fc26b0..2a24c98 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
@@ -162,18 +162,20 @@ public class DefaultListeningIOReactor extends AbstractMultiworkerIOReactor
             if (key.isAcceptable()) {
 
                 ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();
-                SocketChannel socketChannel = null;
-                try {
-                    socketChannel = serverChannel.accept();
-                } catch (IOException ex) {
-                    if (this.exceptionHandler == null ||
-                            !this.exceptionHandler.handle(ex)) {
-                        throw new IOReactorException(
-                                "Failure accepting connection", ex);
+                for (;;) {
+                    SocketChannel socketChannel = null;
+                    try {
+                        socketChannel = serverChannel.accept();
+                    } catch (IOException ex) {
+                        if (this.exceptionHandler == null ||
+                                !this.exceptionHandler.handle(ex)) {
+                            throw new IOReactorException(
+                                    "Failure accepting connection", ex);
+                        }
+                    }
+                    if (socketChannel == null) {
+                        break;
                     }
-                }
-
-                if (socketChannel != null) {
                     try {
                         prepareSocket(socketChannel.socket());
                     } catch (IOException ex) {