Next Enter the next chain task with IMessage and decoded data,iMessage is the decoded IMessage response is the decoded data (Next 通过IMessage和解码后数据进入下一个责任链任务, iMessage 为解码后的IMessage, response 为解码后的数据)
(iMessage ziface.IMessage, response ziface.IcReq)
| 54 | // Next Enter the next chain task with IMessage and decoded data,iMessage is the decoded IMessage response is the decoded data |
| 55 | // (Next 通过IMessage和解码后数据进入下一个责任链任务, iMessage 为解码后的IMessage, response 为解码后的数据) |
| 56 | func (c *Chain) ProceedWithIMessage(iMessage ziface.IMessage, response ziface.IcReq) ziface.IcResp { |
| 57 | if iMessage == nil || response == nil { |
| 58 | return c.Proceed(c.Request()) |
| 59 | } |
| 60 | |
| 61 | req := c.Request() |
| 62 | if req == nil { |
| 63 | return c.Proceed(c.Request()) |
| 64 | } |
| 65 | |
| 66 | iRequest := c.ShouldIRequest(req) |
| 67 | if iRequest == nil { |
| 68 | return c.Proceed(c.Request()) |
| 69 | } |
| 70 | |
| 71 | // Set the request of chain for the next request |
| 72 | // (设置chain的request下一次请求) |
| 73 | iRequest.SetResponse(response) |
| 74 | |
| 75 | return c.Proceed(iRequest) |
| 76 | } |
| 77 | |
| 78 | // ShouldIRequest Determine if it is IRequest(判断是否是IRequest) |
| 79 | func (c *Chain) ShouldIRequest(icReq ziface.IcReq) ziface.IRequest { |
nothing calls this directly
no test coverage detected