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
Brian Tiger Chow committed
Sep 16, 2014 at 01:47 UTC
503b1aa79e0e1d4d71a2ae83f45206595e435fe6
1 file changed
+4
net/service/service.go
+4
@@ -204,3 +204,7 @@ func (s *Service) handleIncomingMessage(ctx context.Context, m msg.NetMessage) {
204
case <-ctx.Done():
205
}
206
}
207
+
208
+func (s *Service) SetHandler(h Handler) {
209
+ s.Handler = h
210
+}