someview commented on issue #1147:
URL: 
https://github.com/apache/pulsar-client-go/issues/1147#issuecomment-1868651164

   I have find  other mistake in the client code:
   ```
   func (c *connection) SendRequest(requestID uint64, req *pb.BaseCommand,
        callback func(command *pb.BaseCommand, err error)) {
        c.incomingRequestsWG.Add(1)
        defer c.incomingRequestsWG.Done()
   
        state := c.getState()
        if state == connectionClosed || state == connectionClosing {
                callback(req, ErrConnectionClosed)
   
        } else {
                select {
                case <-c.closeCh:
                        callback(req, ErrConnectionClosed)
   
                case c.incomingRequestsCh <- &request{
                        id:       &requestID,
                        cmd:      req,
                        callback: callback,
                }:
                }
        }
   }
   
   func (c *connection) closed() bool {
        return connectionClosed == c.getState()
   }
   ```
   The state should be treated as atomic value. 
   


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