@@ -35,8 +35,8 @@ type Protocol struct {
3535 reconnectErrorChan chan error
3636
3737 // serverHealthinessTimeout is the max duration that client will reconnect if no server healthiness
38- // status is received in this duration, if it is 0, this will be disabled .
39- serverHealthinessTimeout time.Duration
38+ // status is received in this duration.
39+ serverHealthinessTimeout * time.Duration
4040}
4141
4242var (
@@ -199,8 +199,8 @@ func (p *Protocol) startEventsReceiver(ctx context.Context,
199199
200200func (p * Protocol ) startHeartbeatWatcher (ctx context.Context , heartbeatCh <- chan * pbv1.CloudEvent ) {
201201 logger := cecontext .LoggerFrom (ctx )
202- // if serverHealthinessTimeout is disable , ignore the server heartbeat timeout
203- if p .serverHealthinessTimeout == 0 {
202+ // if serverHealthinessTimeout is not set , ignore the heartbeat timeout check
203+ if p .serverHealthinessTimeout == nil {
204204 for {
205205 select {
206206 case msg := <- heartbeatCh :
@@ -213,7 +213,7 @@ func (p *Protocol) startHeartbeatWatcher(ctx context.Context, heartbeatCh <-chan
213213
214214 // if no heartbeat was received duration the serverHealthinessTimeout, send the
215215 // timeout error to reconnectErrorChan
216- timeout := p .serverHealthinessTimeout
216+ timeout := * p .serverHealthinessTimeout
217217 timer := time .NewTimer (timeout )
218218 defer timer .Stop ()
219219
0 commit comments