315157973 commented on a change in pull request #10754:
URL: https://github.com/apache/pulsar/pull/10754#discussion_r664450108



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -243,11 +244,18 @@ public ServerCnx(PulsarService pulsar) {
         this.maxPendingBytesPerThread = 
conf.getMaxMessagePublishBufferSizeInMB() * 1024L * 1024L
                 / conf.getNumIOThreads();
         this.resumeThresholdPendingBytesPerThread = 
this.maxPendingBytesPerThread / 2;
+        this.connectionController = new 
ConnectionController.DefaultConnectionController(conf);
     }
 
     @Override
     public void channelActive(ChannelHandlerContext ctx) throws Exception {
         super.channelActive(ctx);
+        if (!connectionController.increaseConnection(remoteAddress)) {
+            ctx.channel().writeAndFlush(Commands.newError(-1, 
ServerError.NotAllowedError
+                    , "Reached the maximum number of connections"));

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to