mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
Our dialer sets up TCP options
This commit is contained in:
parent
abbcd1f436
commit
e4e3c19e96
@ -20,7 +20,6 @@ import (
|
|||||||
"github.com/syncthing/syncthing/lib/discover"
|
"github.com/syncthing/syncthing/lib/discover"
|
||||||
"github.com/syncthing/syncthing/lib/events"
|
"github.com/syncthing/syncthing/lib/events"
|
||||||
"github.com/syncthing/syncthing/lib/model"
|
"github.com/syncthing/syncthing/lib/model"
|
||||||
"github.com/syncthing/syncthing/lib/osutil"
|
|
||||||
"github.com/syncthing/syncthing/lib/protocol"
|
"github.com/syncthing/syncthing/lib/protocol"
|
||||||
"github.com/syncthing/syncthing/lib/relay"
|
"github.com/syncthing/syncthing/lib/relay"
|
||||||
"github.com/syncthing/syncthing/lib/relay/client"
|
"github.com/syncthing/syncthing/lib/relay/client"
|
||||||
@ -368,11 +367,6 @@ func (s *connectionSvc) connect() {
|
|||||||
l.Debugln("Sucessfully joined relay session", inv)
|
l.Debugln("Sucessfully joined relay session", inv)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
|
||||||
if err != nil {
|
|
||||||
l.Infoln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var tc *tls.Conn
|
var tc *tls.Conn
|
||||||
|
|
||||||
if inv.ServerSocket {
|
if inv.ServerSocket {
|
||||||
|
@ -44,11 +44,6 @@ func tcpDialer(uri *url.URL, tlsCfg *tls.Config) (*tls.Conn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
|
||||||
if err != nil {
|
|
||||||
l.Infoln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
tc := tls.Client(conn, tlsCfg)
|
tc := tls.Client(conn, tlsCfg)
|
||||||
err = tc.Handshake()
|
err = tc.Handshake()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"golang.org/x/net/proxy"
|
"golang.org/x/net/proxy"
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/lib/logger"
|
"github.com/syncthing/syncthing/lib/logger"
|
||||||
|
"github.com/syncthing/syncthing/lib/osutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -48,6 +49,9 @@ func Dial(network, addr string) (net.Conn, error) {
|
|||||||
conn, err := dialer.Dial(network, addr)
|
conn, err := dialer.Dial(network, addr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
l.Debugf("Dialing %s address %s via proxy - success, %s -> %s", network, addr, conn.LocalAddr(), conn.RemoteAddr())
|
l.Debugf("Dialing %s address %s via proxy - success, %s -> %s", network, addr, conn.LocalAddr(), conn.RemoteAddr())
|
||||||
|
if tcpconn, ok := conn.(*net.TCPConn); ok {
|
||||||
|
osutil.SetTCPOptions(tcpconn)
|
||||||
|
}
|
||||||
return dialerConn{
|
return dialerConn{
|
||||||
conn, newDialerAddr(network, addr),
|
conn, newDialerAddr(network, addr),
|
||||||
}, nil
|
}, nil
|
||||||
@ -58,6 +62,9 @@ func Dial(network, addr string) (net.Conn, error) {
|
|||||||
conn, err := proxy.Direct.Dial(network, addr)
|
conn, err := proxy.Direct.Dial(network, addr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
l.Debugf("Dialing %s address %s directly - success, %s -> %s", network, addr, conn.LocalAddr(), conn.RemoteAddr())
|
l.Debugf("Dialing %s address %s directly - success, %s -> %s", network, addr, conn.LocalAddr(), conn.RemoteAddr())
|
||||||
|
if tcpconn, ok := conn.(*net.TCPConn); ok {
|
||||||
|
osutil.SetTCPOptions(tcpconn)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
l.Debugf("Dialing %s address %s directly - error %s", network, addr, err)
|
l.Debugf("Dialing %s address %s directly - error %s", network, addr, err)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ package relay
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
@ -249,11 +248,6 @@ func (r *invitationReceiver) Serve() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
|
||||||
if err != nil {
|
|
||||||
l.Infoln(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var tc *tls.Conn
|
var tc *tls.Conn
|
||||||
|
|
||||||
if inv.ServerSocket {
|
if inv.ServerSocket {
|
||||||
|
Loading…
Reference in New Issue
Block a user