ing
This commit is contained in:
parent
19bd7a7b85
commit
fe3407551c
|
@ -50,7 +50,7 @@ func (c *Client) Start() error {
|
|||
|
||||
if 0 >= c.PendingRequests {
|
||||
c.PendingRequests = 1024
|
||||
}
|
||||
}
|
||||
|
||||
readChan, writeChan, err := c.Connector.Connect()
|
||||
if nil != err {
|
||||
|
@ -252,7 +252,7 @@ LOOP:
|
|||
if 0 < rs.id {
|
||||
c.pendingRequests.Store(rs.id, rs)
|
||||
}
|
||||
case <-c.stopChan:
|
||||
case <-stopChan:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -289,11 +289,9 @@ LOOP:
|
|||
continue LOOP
|
||||
}
|
||||
|
||||
c.stopWg.Add(1)
|
||||
go c.handleNotification(notiCodec)
|
||||
} else {
|
||||
// response
|
||||
c.stopWg.Add(1)
|
||||
go c.handleResponse(resCodec)
|
||||
}
|
||||
case <-stopChan:
|
||||
|
@ -304,9 +302,6 @@ LOOP:
|
|||
}
|
||||
|
||||
func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) {
|
||||
defer func() {
|
||||
c.stopWg.Done()
|
||||
}()
|
||||
id := reflect.ValueOf(resCodec.ID()).Convert(uint64Type).Uint()
|
||||
_rs, ok := c.pendingRequests.Load(id)
|
||||
if !ok {
|
||||
|
@ -324,10 +319,6 @@ func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) {
|
|||
}
|
||||
|
||||
func (c *Client) handleNotification(notiCodec protocol.ClientNotificationCodec) {
|
||||
defer func() {
|
||||
c.stopWg.Done()
|
||||
}()
|
||||
|
||||
if nil == c.RPCInvoker {
|
||||
logging.Logger().Warnf("%s received notification method[%s] but RPC Invoker is not exist", c.logHeader(), notiCodec.Method())
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user