提交 503b1aa7 作者: Brian Tiger Chow

feat(net:service) add SetHandler method

Allows the service to be used through an interface.

NB: If the handler is exposed directly, clients of the service cannot swap out their concrete references and replace them with interfaces
上级 6fa0e215
......@@ -204,3 +204,7 @@ func (s *Service) handleIncomingMessage(ctx context.Context, m msg.NetMessage) {
case <-ctx.Done():
}
}
func (s *Service) SetHandler(h Handler) {
s.Handler = h
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论