MCPcopy
hub / github.com/aceld/zinx / doMsgHandler

Method doMsgHandler

znet/msghandler.go:320–344  ·  view source on GitHub ↗

doMsgHandler immediately handles messages in a non-blocking manner (立即以非阻塞方式处理消息)

(request ziface.IRequest, workerID int)

Source from the content-addressed store, hash-verified

318// doMsgHandler immediately handles messages in a non-blocking manner
319// (立即以非阻塞方式处理消息)
320func (mh *MsgHandle) doMsgHandler(request ziface.IRequest, workerID int) {
321 defer func() {
322 if err := recover(); err != nil {
323 zlog.Ins().ErrorF("workerID: %d doMsgHandler panic: %v", workerID, err)
324 }
325 }()
326
327 msgId := request.GetMsgID()
328 handler, ok := mh.Apis[msgId]
329
330 if !ok {
331 zlog.Ins().ErrorF("api msgID = %d is not FOUND!", request.GetMsgID())
332 return
333 }
334
335 // Bind the Request request to the corresponding Router relationship
336 // (Request请求绑定Router对应关系)
337 request.BindRouter(handler)
338
339 // Execute the corresponding processing method
340 request.Call()
341
342 // 执行完成后回收 Request 对象回对象池
343 PutRequest(request)
344}
345
346func (mh *MsgHandle) Execute(request ziface.IRequest) {
347 // Pass the message to the responsibility chain to handle it through interceptors layer by layer and pass it on layer by layer.

Callers 2

InterceptMethod · 0.95
StartOneWorkerMethod · 0.95

Calls 6

InsFunction · 0.92
PutRequestFunction · 0.85
ErrorFMethod · 0.65
GetMsgIDMethod · 0.65
BindRouterMethod · 0.65
CallMethod · 0.65

Tested by

no test coverage detected