@cryptotaxi247 / kubo / commits / 69b1ce42d

nil muxer

Juan Batiz-Benet committed Sep 18, 2014 at 19:42 UTC 69b1ce42d970852e0548e124846baa6f496ddf40
1 file changed +9
net/mux/mux.go
+9
@@ -41,6 +41,10 @@ func (m *Muxer) GetPipe() *msg.Pipe {
41
42 // Start kicks off the Muxer goroutines.
43 func (m *Muxer) Start(ctx context.Context) error {
44 + if m == nil {
45 + panic("nix muxer")
46 + }
47 +
48 if m.cancel != nil {
49 return errors.New("Muxer already started.")
50 }
@@ -75,7 +79,12 @@ func (m *Muxer) AddProtocol(p Protocol, pid ProtocolID) error {
79 // handleIncoming consumes the messages on the m.Incoming channel and
80 // routes them appropriately (to the protocols).
81 func (m *Muxer) handleIncomingMessages(ctx context.Context) {
82 +
83 for {
84 + if m == nil {
85 + panic("nix muxer")
86 + }
87 +
88 select {
89 case msg := <-m.Incoming:
90 go m.handleIncomingMessage(ctx, msg)