cmccabe commented on code in PR #11969:
URL: https://github.com/apache/kafka/pull/11969#discussion_r865499094


##########
core/src/main/scala/kafka/network/SocketServer.scala:
##########
@@ -1864,6 +1780,18 @@ class ConnectionQuotas(config: KafkaConfig, time: Time, 
metrics: Metrics) extend
       sensor
     }
   }
+
+  /**
+   * Close `channel` and decrement the connection count.
+   */
+  def closeChannel(listenerName: ListenerName, channel: SocketChannel): Unit = 
{
+    if (channel != null) {
+      debug(s"Closing connection from 
${channel.socket.getRemoteSocketAddress}")
+      dec(listenerName, channel.socket.getInetAddress)
+      closeSocket(channel, this)

Review Comment:
   Well, the ConnectionQuotas class is tracking how many connections exist. It 
needs to be informed when a connection is closed. If you want, I can have the 
function take a Logging parameter so that we can log until `SocketServer` (or 
whatever) rather than `SocketServer.ConnectionQuotas`. But this is a DEBUG 
level message anyway... realistically, you don't ever see this in prod, so... 
not sure if it matters.



##########
core/src/main/scala/kafka/network/SocketServer.scala:
##########
@@ -1864,6 +1780,18 @@ class ConnectionQuotas(config: KafkaConfig, time: Time, 
metrics: Metrics) extend
       sensor
     }
   }
+
+  /**
+   * Close `channel` and decrement the connection count.
+   */
+  def closeChannel(listenerName: ListenerName, channel: SocketChannel): Unit = 
{
+    if (channel != null) {
+      debug(s"Closing connection from 
${channel.socket.getRemoteSocketAddress}")
+      dec(listenerName, channel.socket.getInetAddress)
+      closeSocket(channel, this)

Review Comment:
   Well, the ConnectionQuotas class is tracking how many connections exist. It 
needs to be informed when a connection is closed. If you want, I can have the 
function take a Logging parameter so that we can log under `SocketServer` (or 
whatever) rather than `SocketServer.ConnectionQuotas`. But this is a DEBUG 
level message anyway... realistically, you don't ever see this in prod, so... 
not sure if it matters.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to