ing
This commit is contained in:
parent
a8acaab5b8
commit
d9973215da
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
@ -297,9 +298,11 @@ func (c *client) rpcReader(readerDone chan<- error) {
|
||||||
|
|
||||||
func (c *client) responseHandle(codecResponse protocol.ClientCodecResponse) error {
|
func (c *client) responseHandle(codecResponse protocol.ClientCodecResponse) error {
|
||||||
c.pendingRequestsLock.Lock()
|
c.pendingRequestsLock.Lock()
|
||||||
cs, ok := c.pendingRequests[codecResponse.ID().(uint64)]
|
id := reflect.ValueOf(codecResponse.ID()).Convert(uint64Type).Uint()
|
||||||
|
|
||||||
|
cs, ok := c.pendingRequests[id]
|
||||||
if ok {
|
if ok {
|
||||||
delete(c.pendingRequests, codecResponse.ID().(uint64))
|
delete(c.pendingRequests, id)
|
||||||
}
|
}
|
||||||
c.pendingRequestsLock.Unlock()
|
c.pendingRequestsLock.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"reflect"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultRequestTimeout is the default timeout for client request.
|
// DefaultRequestTimeout is the default timeout for client request.
|
||||||
|
@ -10,3 +13,5 @@ const (
|
||||||
// handled by Client and Server.
|
// handled by Client and Server.
|
||||||
DefaultPendingMessages = 32 * 1024
|
DefaultPendingMessages = 32 * 1024
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var uint64Type = reflect.TypeOf(uint64(0))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user