in proxy/protocol/dubbo/client/dubbo_client.go [211:244]
func (this *DubboClient) Send(dubboReq *dubbo.Request) (*dubbo.DubboRsp, error) {
this.mapMutex.Lock()
if this.closed {
if err := this.open(); err != nil {
return nil, err
}
}
this.mapMutex.Unlock()
wait := make(chan int)
result := &RespondResult{nil, &wait}
msgID := dubboReq.GetMsgID()
this.AddWaitMsg(msgID, result)
this.routeMgr.Spawn(this, dubboReq, fmt.Sprintf("SndMsgID-%d", dubboReq.GetMsgID()))
var timeout = false
select {
case <-wait:
timeout = false
case <-time.After(this.Timeout):
timeout = true
}
if this.closed {
openlog.Info("Client been closed.")
return nil, &util.BaseError{"Client been closed."}
}
this.RemoveWaitMsg(msgID)
if timeout {
dubboReq.SetBroken(true)
openlog.Info("Client send timeout.")
return nil, &util.BaseError{"timeout"}
} else {
return result.Rsp, nil
}
}