raft: makes 'ConnReadTimeout/ConnWriteTimeout' customizable

This commit is contained in:
Maksim Buldukyan
2021-02-08 11:04:48 +07:00
parent 44c889a8ce
commit 7e38cfcc8d
3 changed files with 26 additions and 6 deletions

View File

@@ -37,8 +37,8 @@ const (
// to keep the connection alive.
// For short term pipeline connections, the connection MUST be killed to avoid it being
// put back to http pkg connection pool.
ConnReadTimeout = 5 * time.Second
ConnWriteTimeout = 5 * time.Second
DefaultConnReadTimeout = 5 * time.Second
DefaultConnWriteTimeout = 5 * time.Second
recvBufSize = 4096
// maxPendingProposals holds the proposals during one leader election process.
@@ -55,6 +55,11 @@ const (
sendSnap = "sendMsgSnap"
)
var (
ConnReadTimeout = DefaultConnReadTimeout
ConnWriteTimeout = DefaultConnWriteTimeout
)
type Peer interface {
// send sends the message to the remote peer. The function is non-blocking
// and has no promise that the message will be received by the remote.