@cryptotaxi247 / kubo / commits / f9650a790

allow service to have nil handler

@perfmode this means we can create a Service first, give it to the network and protocol (removing interdep).

Juan Batiz-Benet committed Sep 15, 2014 at 16:20 UTC f9650a79068f5968d6a343bb8a686f8661725cba
1 file changed +5
net/service/service.go
+5
@@ -161,6 +161,11 @@ func (s *Service) handleIncomingMessage(ctx context.Context, m msg.NetMessage) {
161
162 // if it's a request (or has no RequestID), handle it
163 if rid == nil || rid.IsRequest() {
164 + if s.Handler == nil {
165 + u.PErr("service dropped msg: %v\n", m)
166 + return // no handler, drop it.
167 + }
168 +
169 r1, err := s.Handler.HandleMessage(ctx, m2)
170 if err != nil {
171 u.PErr("handled message yielded error %v\n", err)