mirror of
https://github.com/soypat/lneto.git
synced 2026-08-20 14:39:02 +00:00
Retransmit active-open SYN after RTO (#130)
* added: sync packet retransmission * test: sync packet retransmission * refactor: remove packet time from tcppool * fix: return comment * refactor: move retrying to stackRetrying * added: retries & timeout to stackGoConfig * test: test retries stack * refactor: move StackRetrying to stackBlocking * fix: line gofmt --------- Co-authored-by: Pat Whittingslow <graded.sp@gmail.com>
This commit is contained in:
@@ -181,6 +181,14 @@ func (s StackBlocking) DoDialTCP(conn *tcp.Conn, localPort uint16, addrp netip.A
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = s.waitDialTCP(conn, timeout)
|
||||
if err != nil {
|
||||
conn.Abort()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s StackBlocking) waitDialTCP(conn *tcp.Conn, timeout time.Duration) (err error) {
|
||||
deadline := time.Now().Add(timeout)
|
||||
var backoffs uint
|
||||
for range maxIter {
|
||||
@@ -189,12 +197,10 @@ func (s StackBlocking) DoDialTCP(conn *tcp.Conn, localPort uint16, addrp netip.A
|
||||
return nil
|
||||
} else if state == tcp.StateSynSent || state == tcp.StateSynRcvd || conn.AwaitingSynSend() {
|
||||
if err = s.checkDeadline(deadline); err != nil {
|
||||
conn.Abort()
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// Unexpected state, abort and terminate connection.
|
||||
conn.Abort()
|
||||
return errTCPFailedToConnect
|
||||
}
|
||||
s.backoff(backoffs)
|
||||
|
||||
Reference in New Issue
Block a user