mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 17:45:03 +09:00
yamux fixes
This commit is contained in:
parent
2ec42e5e1f
commit
ddc900a93c
4 changed files with 2 additions and 7 deletions
|
@ -8,5 +8,4 @@ type Config struct {
|
|||
ListenAddrs []string `yaml:"listenAddrs"`
|
||||
WriteTimeoutSec int `yaml:"writeTimeoutSec"`
|
||||
DialTimeoutSec int `yaml:"dialTimeoutSec"`
|
||||
MaxStreams int `yaml:"maxStreams"`
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func (y *yamuxConn) Open(ctx context.Context) (conn net.Conn, err error) {
|
|||
if conn, err = y.Session.Open(); err != nil {
|
||||
return
|
||||
}
|
||||
return connutil.NewTimeout(conn, time.Second*10), nil
|
||||
return
|
||||
}
|
||||
|
||||
func (y *yamuxConn) LastUsage() time.Time {
|
||||
|
@ -51,5 +51,5 @@ func (y *yamuxConn) Accept() (conn net.Conn, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
return connutil.NewTimeout(conn, time.Second*10), nil
|
||||
return
|
||||
}
|
||||
|
|
|
@ -43,9 +43,6 @@ func (y *yamuxTransport) Init(a *app.App) (err error) {
|
|||
y.secure = a.MustComponent(secureservice.CName).(secureservice.SecureService)
|
||||
y.conf = a.MustComponent("config").(configGetter).GetYamux()
|
||||
y.yamuxConf = yamux.DefaultConfig()
|
||||
if y.conf.MaxStreams > 0 {
|
||||
y.yamuxConf.AcceptBacklog = y.conf.MaxStreams
|
||||
}
|
||||
y.yamuxConf.EnableKeepAlive = false
|
||||
y.yamuxConf.StreamOpenTimeout = time.Duration(y.conf.DialTimeoutSec) * time.Second
|
||||
y.yamuxConf.ConnectionWriteTimeout = time.Duration(y.conf.WriteTimeoutSec) * time.Second
|
||||
|
|
|
@ -173,7 +173,6 @@ func (c *testConf) GetYamux() Config {
|
|||
ListenAddrs: []string{"127.0.0.1:0"},
|
||||
WriteTimeoutSec: 10,
|
||||
DialTimeoutSec: 10,
|
||||
MaxStreams: 1024,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue