mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +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/events"
|
||||
"github.com/syncthing/syncthing/lib/model"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/relay"
|
||||
"github.com/syncthing/syncthing/lib/relay/client"
|
||||
@ -368,11 +367,6 @@ func (s *connectionSvc) connect() {
|
||||
l.Debugln("Sucessfully joined relay session", inv)
|
||||
}
|
||||
|
||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
||||
if err != nil {
|
||||
l.Infoln(err)
|
||||
}
|
||||
|
||||
var tc *tls.Conn
|
||||
|
||||
if inv.ServerSocket {
|
||||
|
@ -44,11 +44,6 @@ func tcpDialer(uri *url.URL, tlsCfg *tls.Config) (*tls.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
||||
if err != nil {
|
||||
l.Infoln(err)
|
||||
}
|
||||
|
||||
tc := tls.Client(conn, tlsCfg)
|
||||
err = tc.Handshake()
|
||||
if err != nil {
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"golang.org/x/net/proxy"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/logger"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -48,6 +49,9 @@ func Dial(network, addr string) (net.Conn, error) {
|
||||
conn, err := dialer.Dial(network, addr)
|
||||
if err == nil {
|
||||
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{
|
||||
conn, newDialerAddr(network, addr),
|
||||
}, nil
|
||||
@ -58,6 +62,9 @@ func Dial(network, addr string) (net.Conn, error) {
|
||||
conn, err := proxy.Direct.Dial(network, addr)
|
||||
if err == nil {
|
||||
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 {
|
||||
l.Debugf("Dialing %s address %s directly - error %s", network, addr, err)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ package relay
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
@ -249,11 +248,6 @@ func (r *invitationReceiver) Serve() {
|
||||
continue
|
||||
}
|
||||
|
||||
err = osutil.SetTCPOptions(conn.(*net.TCPConn))
|
||||
if err != nil {
|
||||
l.Infoln(err)
|
||||
}
|
||||
|
||||
var tc *tls.Conn
|
||||
|
||||
if inv.ServerSocket {
|
||||
|
Loading…
Reference in New Issue
Block a user