Skip to content

Commit

Permalink
Simplify ListenAndServe
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyipanuber committed Aug 21, 2023
1 parent 88106eb commit aab00ca
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,9 @@ func (ch *Channel) ListenAndServe(hostPort string) error {
return errAlreadyListening
}

var l net.Listener
var err error
if ch.enableMPTCP {
lc := &net.ListenConfig{}
lc.SetMultipathTCP(true)
l, err = lc.Listen(context.Background(), "tcp", hostPort)
} else {
l, err = net.Listen("tcp", hostPort)
}
lc := net.ListenConfig{}
lc.SetMultipathTCP(ch.enableMPTCP)
l, err := lc.Listen(context.Background(), "tcp", hostPort)
if err != nil {
mutable.RUnlock()
return err
Expand Down

0 comments on commit aab00ca

Please sign in to comment.