-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.go
42 lines (31 loc) · 1.39 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package mnet
import "time"
const (
// MinTemporarySleep sets the minimum, initial sleep a network should
// take when facing a Temporary net error.
MinTemporarySleep = 10 * time.Millisecond
// MaxTemporarySleep sets the maximum, allowed sleep a network should
// take when facing a Temporary net error.
MaxTemporarySleep = 1 * time.Second
// MaxFlushDeadline sets the maximum, allowed duration for flushing data
MaxFlushDeadline = 3 * time.Second
// MinBufferSize sets the initial size of space of the slice
// used to read in content from a net.Conn in the connections
// read loop.
MinBufferSize = 512
// MaxBufferSize sets the maximum size allowed for all reads
// used in the readloop of a client's net.Conn.
MaxBufferSize = 69560
// DefaultDialTimeout sets the default maximum time in seconds allowed before
// a net.Dialer exits attempt to dial a network.
DefaultDialTimeout = 3 * time.Second
// DefaultKeepAlive sets the default maximum time to keep alive a tcp connection
// during no-use. It is used by net.Dialer.
DefaultKeepAlive = 3 * time.Minute
// DefaultReconnectBufferSize sets the size of the buffer during reconnection.
DefaultReconnectBufferSize = 1024 * 1024 * 8
// HeaderLength defines the size of giving byte slice for message length header.
HeaderLength = 4
// MaxHeaderSize defines size of max header for message header length.
MaxHeaderSize = uint32(4294967295)
)