@@ -44,22 +44,22 @@ func WithTimeoutUpdateFrequency(frequency int) TimeoutOptions {
4444 }
4545}
4646
47- // WithTMHandshakeTimeout is used to set the timeout used during the handshake.
47+ // WithHandshakeTimeout is used to set the timeout used during the handshake.
4848// If the timeout is reached without response from the peer then the handshake
4949// will be aborted and restarted.
50- func WithTMHandshakeTimeout (timeout time.Duration ) TimeoutOptions {
50+ func WithHandshakeTimeout (timeout time.Duration ) TimeoutOptions {
5151 return func (manager * TimeoutManager ) {
5252 manager .handshakeTimeout = timeout
5353 }
5454}
5555
56- // WithTMKeepalivePing is used to send a ping packet if no packets have been
56+ // WithKeepalivePing is used to send a ping packet if no packets have been
5757// received from the other side for the given duration. This helps keep the
5858// connection alive and also ensures that the connection is closed if the
5959// other side does not respond to the ping in a timely manner. After the ping
6060// the connection will be closed if the other side does not respond within
6161// time duration.
62- func WithTMKeepalivePing (ping , pong time.Duration ) TimeoutOptions {
62+ func WithKeepalivePing (ping , pong time.Duration ) TimeoutOptions {
6363 return func (manager * TimeoutManager ) {
6464 manager .pingTime = ping
6565 manager .pongTime = pong
@@ -90,10 +90,6 @@ type config struct {
9090 // between packets.
9191 maxChunkSize int
9292
93- // resendTimeout is the duration that will be waited before resending
94- // the packets in the current queue.
95- resendTimeout time.Duration
96-
9793 // recvFromStream is the function that will be used to acquire the next
9894 // available packet.
9995 recvFromStream recvBytesFunc
@@ -106,25 +102,17 @@ type config struct {
106102 // been received and processed.
107103 onFIN func ()
108104
109- // handshakeTimeout is the time after which the server or client
110- // will abort and restart the handshake if the expected response is
111- // not received from the peer.
112- handshakeTimeout time.Duration
113-
114- pingTime time.Duration
115- pongTime time.Duration
105+ timeoutOptions []TimeoutOptions
116106}
117107
118108// newConfig constructs a new config struct.
119109func newConfig (sendFunc sendBytesFunc , recvFunc recvBytesFunc ,
120110 n uint8 ) * config {
121111
122112 return & config {
123- n : n ,
124- s : n + 1 ,
125- recvFromStream : recvFunc ,
126- sendToStream : sendFunc ,
127- resendTimeout : defaultResendTimeout ,
128- handshakeTimeout : defaultHandshakeTimeout ,
113+ n : n ,
114+ s : n + 1 ,
115+ recvFromStream : recvFunc ,
116+ sendToStream : sendFunc ,
129117 }
130118}
0 commit comments