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:
parent
fe83f61998
commit
3c7b32056b
1 changed files with 3 additions and 2 deletions
|
@ -746,7 +746,7 @@ func StartClient(conn *websocket.Conn) (err error) {
|
||||||
|
|
||||||
defer close(c.done)
|
defer close(c.done)
|
||||||
|
|
||||||
c.writeCh = make(chan interface{}, 25)
|
c.writeCh = make(chan interface{}, 100)
|
||||||
c.writerDone = make(chan struct{})
|
c.writerDone = make(chan struct{})
|
||||||
go clientWriter(conn, c.writeCh, c.writerDone)
|
go clientWriter(conn, c.writeCh, c.writerDone)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -1497,7 +1497,8 @@ func clientWriter(conn *websocket.Conn, ch <-chan interface{}, done chan<- struc
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
err := conn.SetWriteDeadline(
|
err := conn.SetWriteDeadline(
|
||||||
time.Now().Add(2 * time.Second))
|
time.Now().Add(500 * time.Millisecond),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue