Skip to content

Commit

Permalink
fix: ensure that pings don't get stuck behind writes
Browse files Browse the repository at this point in the history
This:

1. Sets the max message size to 4 KiB. That should be large enough to
fill up most packets.
2. Sends pings/pongs first before processing messages.

This ensures that:

1. RTT times are accurate.
2. We don't end up thinking the connection is dead because a ping keeps
   getting stuck behind a message.
  • Loading branch information
Stebalien committed Jan 6, 2022
1 parent 6c2bbc3 commit accec74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func DefaultConfig() *Config {
MaxStreamWindowSize: maxStreamWindow,
LogOutput: os.Stderr,
ReadBufSize: 4096,
MaxMessageSize: 64 * 1024,
MaxMessageSize: 4 * 1024,
WriteCoalesceDelay: 100 * time.Microsecond,
}
}
Expand Down

0 comments on commit accec74

Please sign in to comment.