mnet: fix PacketConn support again

This commit is contained in:
Brian Picciano 2019-03-01 14:36:16 -05:00
parent 5bd3bf1d6d
commit a52230b972

View File

@ -88,14 +88,15 @@ func WithListener(ctx context.Context, opts ...ListenerOpt) (context.Context, *L
if lOpts.isPacketConn() { if lOpts.isPacketConn() {
l.PacketConn, err = net.ListenPacket(lOpts.proto, *addr) l.PacketConn, err = net.ListenPacket(lOpts.proto, *addr)
l.ctx = mctx.Annotate(l.ctx, "addr", l.PacketConn.LocalAddr().String())
} else { } else {
l.Listener, err = net.Listen(lOpts.proto, *addr) l.Listener, err = net.Listen(lOpts.proto, *addr)
l.ctx = mctx.Annotate(l.ctx, "addr", l.Listener.Addr().String())
} }
if err != nil { if err != nil {
return merr.Wrap(err, l.ctx) return merr.Wrap(err, l.ctx)
} }
l.ctx = mctx.Annotate(l.ctx, "addr", l.Addr().String())
mlog.Info("listening", l.ctx) mlog.Info("listening", l.ctx)
return nil return nil
}) })