[ 
https://issues.apache.org/jira/browse/SCB-687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550171#comment-16550171
 ] 

ASF GitHub Bot commented on SCB-687:
------------------------------------

wujimin commented on a change in pull request #824: [SCB-687] add highway 
server connection protection
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/824#discussion_r203929543
 
 

 ##########
 File path: 
foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java
 ##########
 @@ -57,8 +69,18 @@ public void init(Vertx vertx, String sslKey, 
AsyncResultCallback<InetSocketAddre
     }
 
     netServer.connectHandler(netSocket -> {
-      TcpServerConnection connection = createTcpServerConnection();
-      connection.init(netSocket);
+      if (connectedCounter.get() < connectionLimit) {
 
 Review comment:
   seems this is more clear.
   ```
   if (connectedCounter.incrementAndGet() > connectionLimit){
     connectedCounter.decrementAndGet();
     netSocket.close();
     return;
   }
   
   TcpServerConnection connection = createTcpServerConnection();
   connection.init(netSocket, connectedCounter);
   EventManager.post(new ClientConnectedEvent(netSocket, connectedCount));
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> highway server not accept too many connection
> ---------------------------------------------
>
>                 Key: SCB-687
>                 URL: https://issues.apache.org/jira/browse/SCB-687
>             Project: Apache ServiceComb
>          Issue Type: Sub-task
>          Components: Java-Chassis
>            Reporter: wujimin
>            Assignee: yangyongzheng
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to