Skip to content

Commit

Permalink
remove prefaceTimer
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbza committed Feb 8, 2019
1 parent a195f7c commit 1aff12e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,6 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
Authority: ac.cc.authority,
}

prefaceTimer := time.NewTimer(time.Until(connectDeadline))

onGoAway := func(r transport.GoAwayReason) {
ac.mu.Lock()
ac.adjustParams(r)
Expand All @@ -1132,13 +1130,11 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne

onClose := func() {
close(onCloseCalled)
prefaceTimer.Stop()
reconnect.Fire()
}

onPrefaceReceipt := func() {
close(prefaceReceived)
prefaceTimer.Stop()
}

connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline)
Expand All @@ -1164,7 +1160,7 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne

if ac.dopts.reqHandshake == envconfig.RequireHandshakeOn {
select {
case <-prefaceTimer.C:
case <-time.After(connectDeadline.Sub(time.Now())):
// We didn't get the preface in time.
newTr.Close()
grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v: didn't receive server preface in time. Reconnecting...", addr)
Expand Down

0 comments on commit 1aff12e

Please sign in to comment.