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
This commit is contained in:
Brian Tiger Chow 2014-09-16 01:47:15 -07:00
parent 6fa0e2157f
commit 503b1aa79e

View File

@ -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
}