@@ -224,25 +224,25 @@ func (t *grpcTunnel) serve(tunnelCtx context.Context) {
224224 // In either scenario, we should return here and close the tunnel as it is no longer needed.
225225 klog .V (1 ).InfoS ("DialResp not recognized; dropped" , "connectionID" , resp .ConnectID , "dialID" , resp .Random )
226226 return
227- } else {
228- result := dialResult { connid : resp . ConnectID }
229- if resp . Error != "" {
230- result . err = & dialFailure { resp .Error , DialFailureEndpoint }
231- }
232- select {
233- // try to send to the result channel
234- case pendingDial . resultCh <- result :
235- // unblock if the cancel channel is closed
236- case <- pendingDial . cancelCh :
237- // Note: this condition can only be hit by a race condition where the
238- // DialContext() returns early (timeout) after the pendingDial is already
239- // fetched here, but before the result is sent.
240- klog . V ( 1 ). InfoS ( "Pending dial has been cancelled; dropped" , "connectionID" , resp . ConnectID , "dialID" , resp . Random )
241- return
242- case <- tunnelCtx . Done ():
243- klog . V ( 1 ). InfoS ( "Tunnel has been closed; dropped" , "connectionID" , resp . ConnectID , "dialID" , resp . Random )
244- return
245- }
227+ }
228+
229+ result := dialResult { connid : resp . ConnectID }
230+ if resp .Error != "" {
231+ result . err = & dialFailure { resp . Error , DialFailureEndpoint }
232+ }
233+ select {
234+ // try to send to the result channel
235+ case pendingDial . resultCh <- result :
236+ // unblock if the cancel channel is closed
237+ case <- pendingDial . cancelCh :
238+ // Note: this condition can only be hit by a race condition where the
239+ // DialContext() returns early (timeout) after the pendingDial is already
240+ // fetched here, but before the result is sent.
241+ klog . V ( 1 ). InfoS ( "Pending dial has been cancelled; dropped" , "connectionID" , resp . ConnectID , "dialID" , resp . Random )
242+ return
243+ case <- tunnelCtx . Done ():
244+ klog . V ( 1 ). InfoS ( "Tunnel has been closed; dropped" , "connectionID" , resp . ConnectID , "dialID" , resp . Random )
245+ return
246246 }
247247
248248 if resp .Error != "" {
0 commit comments