diff --git a/client/client.go b/client/client.go index 1d1b3cb..c234a3e 100644 --- a/client/client.go +++ b/client/client.go @@ -16,10 +16,11 @@ import ( var uint64Type = reflect.TypeOf(uint64(0)) type Client struct { - Connector csc.Connector - Codec protocol.ClientCodec - RPCInvoker registry.RPCInvoker - Name string + Connector csc.Connector + 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)