in proxy/protocol/dubbo/server/dubbo_conn.go [167:195]
func (this *DubboConnection) HandleMsg(req *dubbo.Request) {
//这里发送Rest请求以及收发送应答
ctx := &dubbo.InvokeContext{req, &dubbo.DubboRsp{}, nil, "", this.remoteAddr}
ctx.Rsp.Init()
ctx.Rsp.SetID(req.GetMsgID())
if req.IsHeartbeat() {
ctx.Rsp.SetValue(nil)
ctx.Rsp.SetEvent(true)
ctx.Rsp.SetStatus(dubbo.Ok)
} else {
//这里重新分配MSGID
srcMsgID := ctx.Req.GetMsgID()
dstMsgID := dubbo.GenerateMsgID()
//openlog.Info(fmt.Sprintf("dubbo2dubbo srcMsgID=%d, newMsgID=%d", srcMsgID, dstMsgID))
ctx.Req.SetMsgID(dstMsgID)
err := dubboproxy.Handle(ctx)
if err != nil {
ctx.Rsp.SetErrorMsg(err.Error())
openlog.Error("request: " + err.Error())
ctx.Rsp.SetStatus(dubbo.ServerError)
}
ctx.Req.SetMsgID(srcMsgID)
ctx.Rsp.SetID(srcMsgID)
}
if req.IsTwoWay() {
this.msgque.Enqueue(ctx.Rsp)
}
}