This commit is contained in:
crusader 2018-04-19 20:58:24 +09:00
parent 5e7c06fad3
commit 19bd7a7b85

View File

@ -20,6 +20,7 @@ type Client struct {
Codec protocol.ClientCodec
RPCInvoker registry.RPCInvoker
Name string
PendingRequests int
stopChan chan struct{}
stopWg sync.WaitGroup
@ -47,11 +48,16 @@ func (c *Client) Start() error {
return fmt.Errorf("%s Codec is not valid", c.logHeader())
}
if 0 >= c.PendingRequests {
c.PendingRequests = 1024
}
readChan, writeChan, err := c.Connector.Connect()
if nil != err {
return err
}
c.requestQueueChan = make(chan *requestState, c.PendingRequests)
c.stopChan = make(chan struct{})
c.stopWg.Add(1)