ing
This commit is contained in:
parent
a8044481d9
commit
0464cbccb3
|
@ -158,14 +158,18 @@ func (ccrn *ClientCodecResponseOrNotify) Complete() {
|
|||
var clientRequestPool sync.Pool
|
||||
|
||||
func retainClientRequest(method string, params interface{}, id interface{}) *clientRequest {
|
||||
var cr *clientRequest
|
||||
v := clientRequestPool.Get()
|
||||
if v == nil {
|
||||
return &clientRequest{}
|
||||
cr = &clientRequest{}
|
||||
} else {
|
||||
cr = v.(*clientRequest)
|
||||
}
|
||||
cr := v.(*clientRequest)
|
||||
|
||||
cr.Method = method
|
||||
cr.Params = params
|
||||
cr.ID = id
|
||||
|
||||
return cr
|
||||
}
|
||||
|
||||
|
|
|
@ -226,12 +226,14 @@ type EmptyResponse struct {
|
|||
var serverCodecRequestPool sync.Pool
|
||||
|
||||
func retainServerCodecRequest(request *serverRequest, err error, encoder encode.Encoder) *ServerCodecRequest {
|
||||
var scr *ServerCodecRequest
|
||||
v := serverCodecRequestPool.Get()
|
||||
if v == nil {
|
||||
return &ServerCodecRequest{}
|
||||
scr = &ServerCodecRequest{}
|
||||
} else {
|
||||
scr = v.(*ServerCodecRequest)
|
||||
}
|
||||
|
||||
scr := v.(*ServerCodecRequest)
|
||||
scr.request = request
|
||||
scr.err = err
|
||||
scr.encoder = encoder
|
||||
|
@ -268,11 +270,14 @@ func releaseServerRequest(sr *serverRequest) {
|
|||
var serverResponsePool sync.Pool
|
||||
|
||||
func retainServerResponse(version string, result interface{}, err *Error, id *json.RawMessage) *serverResponse {
|
||||
var sr *serverResponse
|
||||
v := serverResponsePool.Get()
|
||||
if v == nil {
|
||||
return &serverResponse{}
|
||||
sr = &serverResponse{}
|
||||
} else {
|
||||
sr = v.(*serverResponse)
|
||||
}
|
||||
sr := v.(*serverResponse)
|
||||
|
||||
sr.Version = version
|
||||
sr.Result = result
|
||||
sr.Error = err
|
||||
|
|
Loading…
Reference in New Issue
Block a user