File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ func (m *ConnectionManager) preConnectionCopy(ctx context.Context, source net.Co
235
235
err = m .connectionCopyEarlyWrite (source , destination , readHandshake , writeHandshake )
236
236
if err == nil && N .NeedHandshakeForRead (source ) {
237
237
continue
238
- } else if err == os .ErrInvalid || err == context .DeadlineExceeded {
238
+ } else if E . IsMulti ( err , os .ErrInvalid , context .DeadlineExceeded , io . EOF ) {
239
239
err = nil
240
240
}
241
241
break
@@ -340,10 +340,19 @@ func (m *ConnectionManager) connectionCopyEarlyWrite(source net.Conn, destinatio
340
340
}
341
341
return err
342
342
}
343
+ var (
344
+ isTimeout bool
345
+ isEOF bool
346
+ )
343
347
_ , err = payload .ReadOnceFrom (source )
344
- isTimeout := E .IsTimeout (err )
345
- if err != nil && ! (isTimeout || errors .Is (err , io .EOF )) {
346
- return E .Cause (err , "read payload" )
348
+ if err != nil {
349
+ if E .IsTimeout (err ) {
350
+ isTimeout = true
351
+ } else if errors .Is (err , io .EOF ) {
352
+ isEOF = true
353
+ } else {
354
+ return E .Cause (err , "read payload" )
355
+ }
347
356
}
348
357
_ = source .SetReadDeadline (time.Time {})
349
358
if ! payload .IsEmpty () || writeHandshake {
@@ -354,6 +363,8 @@ func (m *ConnectionManager) connectionCopyEarlyWrite(source net.Conn, destinatio
354
363
}
355
364
if isTimeout {
356
365
return context .DeadlineExceeded
366
+ } else if isEOF {
367
+ return io .EOF
357
368
}
358
369
return nil
359
370
}
You can’t perform that action at this time.
0 commit comments