From 503b1aa79e0e1d4d71a2ae83f45206595e435fe6 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Tue, 16 Sep 2014 01:47:15 -0700 Subject: [PATCH] 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 --- net/service/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/service/service.go b/net/service/service.go index c0f3d8be8..caa2e2354 100644 --- a/net/service/service.go +++ b/net/service/service.go @@ -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 +}