Skip to content

Commit

Permalink
Logs for mptcp status
Browse files Browse the repository at this point in the history
  • Loading branch information
vikulin committed Dec 20, 2023
1 parent c3ce782 commit 673dc9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ func (l *links) listen(u *url.URL, sintf string) (*Listener, error) {
if err != nil {
return
}
if u.Scheme == "mptcp" {
isMultipathTCP, err := conn.(*net.TCPConn).MultipathTCP() // Check if the connection supports mptcp
l.core.log.Infof("Accepted connection from %s with mptcp: %t, err: %v\n", conn.RemoteAddr(), isMultipathTCP, err)
} else {
l.core.log.Warnf("MultipathTCP is not on. TCP will be used.")
}
go func(conn net.Conn) {
defer conn.Close()

Expand Down
5 changes: 5 additions & 0 deletions src/core/link_mptcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func (l *linkMPTCP) dialerFor(dst *net.TCPAddr, sintf string) (*net.Dialer, erro
Control: l.tcp.tcpContext,
}
dialer.SetMultipathTCP(true)
if dialer.MultipathTCP() {
l.core.log.Infof("Enabled MPTCP")
} else {
l.core.log.Warnf("MultipathTCP is not on after having been forced to on. TCP will be used.")
}
if sintf != "" {
dialer.Control = l.tcp.getControl(sintf)
ief, err := net.InterfaceByName(sintf)
Expand Down

0 comments on commit 673dc9b

Please sign in to comment.