fishy commented on a change in pull request #2497:
URL: https://github.com/apache/thrift/pull/2497#discussion_r779801806



##########
File path: lib/go/thrift/simple_server.go
##########
@@ -193,7 +195,13 @@ func (p *TSimpleServer) innerAccept() (int32, error) {
        }
        if client != nil {
                p.wg.Add(1)
+               p.clients[client] = struct{}{}
                go func() {
+                       defer func() {
+                               p.mu.Lock()
+                               defer p.mu.Unlock()
+                               delete(p.clients, client)

Review comment:
       Another idea I had considered before for a different issue is to add an 
`Unwrap() TTransport` api to `TTransport`, similar to how `errors.Unwrap()` 
works. This way we can keep unwrapping until we find the `*TSocket` or 
`*TSSLSocket` wrapped under the hood and use its `Addr().String()` as the map 
key (and if there's no `*TSocket`/`*TSSLSocket`, then we don't put this client 
into the map).




-- 
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