mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 05:13:11 -06:00
Tweaks
This commit is contained in:
parent
563b946e34
commit
de09f4c759
|
|
@ -87,9 +87,9 @@ func main() {
|
|||
httpServer := &http.Server{
|
||||
Addr: ":0",
|
||||
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){},
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
IdleTimeout: 15 * time.Second,
|
||||
ReadTimeout: 30 * time.Second,
|
||||
WriteTimeout: 30 * time.Second,
|
||||
IdleTimeout: 60 * time.Second,
|
||||
BaseContext: func(_ net.Listener) context.Context {
|
||||
return context.Background()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func Setup(instanceName string) (*Node, error) {
|
|||
panic(err)
|
||||
}
|
||||
if e := ioutil.WriteFile(yggfile, j, 0600); e != nil {
|
||||
fmt.Printf("Couldn't write private key to file '%s': %s\n", yggfile, e)
|
||||
n.log.Printf("Couldn't write private key to file '%s': %s\n", yggfile, e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package yggconn
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
|
|
@ -12,7 +11,9 @@ import (
|
|||
func (n *Node) yamuxConfig() *yamux.Config {
|
||||
cfg := yamux.DefaultConfig()
|
||||
cfg.EnableKeepAlive = true
|
||||
cfg.KeepAliveInterval = time.Second * 5
|
||||
cfg.KeepAliveInterval = time.Second * 30
|
||||
cfg.MaxMessageSize = 65535
|
||||
cfg.ReadBufSize = 655350
|
||||
return cfg
|
||||
}
|
||||
|
||||
|
|
@ -20,12 +21,12 @@ func (n *Node) listenFromYgg() {
|
|||
for {
|
||||
conn, err := n.listener.Accept()
|
||||
if err != nil {
|
||||
fmt.Println("n.listener.Accept:", err)
|
||||
n.log.Println("n.listener.Accept:", err)
|
||||
return
|
||||
}
|
||||
session, err := yamux.Server(conn, n.yamuxConfig())
|
||||
if err != nil {
|
||||
fmt.Println("yamux.Server:", err)
|
||||
n.log.Println("yamux.Server:", err)
|
||||
return
|
||||
}
|
||||
go n.listenFromYggConn(session)
|
||||
|
|
@ -39,7 +40,7 @@ func (n *Node) listenFromYggConn(session *yamux.Session) {
|
|||
for {
|
||||
st, err := session.AcceptStream()
|
||||
if err != nil {
|
||||
fmt.Println("session.AcceptStream:", err)
|
||||
n.log.Println("session.AcceptStream:", err)
|
||||
return
|
||||
}
|
||||
n.incoming <- st
|
||||
|
|
@ -73,12 +74,12 @@ func (n *Node) DialContext(ctx context.Context, network, address string) (net.Co
|
|||
if !ok1 || !ok2 {
|
||||
conn, err := n.dialer.DialContext(ctx, network, address)
|
||||
if err != nil {
|
||||
fmt.Println("n.dialer.DialContext:", err)
|
||||
n.log.Println("n.dialer.DialContext:", err)
|
||||
return nil, err
|
||||
}
|
||||
session, err = yamux.Client(conn, n.yamuxConfig())
|
||||
if err != nil {
|
||||
fmt.Println("yamux.Client.AcceptStream:", err)
|
||||
n.log.Println("yamux.Client.AcceptStream:", err)
|
||||
return nil, err
|
||||
}
|
||||
go n.listenFromYggConn(session)
|
||||
|
|
|
|||
Loading…
Reference in a new issue