1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Reduce writer timeout, increase amount of buffering.

If the writer gets congested, the whole group might be delayed.  Better
to drop the slow client in that case.
This commit is contained in:
Juliusz Chroboczek 2021-02-14 16:24:22 +01:00
parent fe83f61998
commit 3c7b32056b

View file

@ -746,7 +746,7 @@ func StartClient(conn *websocket.Conn) (err error) {
defer close(c.done)
c.writeCh = make(chan interface{}, 25)
c.writeCh = make(chan interface{}, 100)
c.writerDone = make(chan struct{})
go clientWriter(conn, c.writeCh, c.writerDone)
defer func() {
@ -1497,7 +1497,8 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc
break
}
err := conn.SetWriteDeadline(
time.Now().Add(2 * time.Second))
time.Now().Add(500 * time.Millisecond),
)
if err != nil {
return
}