-
Notifications
You must be signed in to change notification settings - Fork 21
gbn: set resend timeout dynamically #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6000041
50db412
17b8366
5c2d3f3
8b21c76
d924596
d92c615
73b69f0
ea84c35
b461313
da8143f
931a7c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,7 @@ func (g *GoBackNConn) clientHandshake() error { | |
| var ( | ||
| resp Message | ||
| respSYN *PacketSYN | ||
| resent bool | ||
| ) | ||
| handshake: | ||
| for { | ||
|
|
@@ -115,6 +116,9 @@ handshake: | |
| return err | ||
| } | ||
|
|
||
| // Notify the timeout manager that we sent a SYN. | ||
| g.timeoutManager.Sent(msg, resent) | ||
|
|
||
| for { | ||
| // Wait for SYN | ||
| g.log.Debugf("Waiting for SYN") | ||
|
|
@@ -128,11 +132,14 @@ handshake: | |
| default: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! i'd just add a small note to the commit message saying that this is basically just a refactor with no behaviour changes since the timeout mgr is not set being used for dynamic timeouts. Could even, just to emphasis this no-behaviour change point, add the "WithStaticTimeout" option on initialisation (to be removed in the upcoming commits of course)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! The commit messages & order have been updated |
||
| } | ||
|
|
||
| timeout := g.timeoutManager.GetHandshakeTimeout() | ||
|
|
||
| var b []byte | ||
| select { | ||
| case <-time.After(g.cfg.handshakeTimeout): | ||
| case <-time.After(timeout): | ||
| g.log.Debugf("SYN resendTimeout. Resending " + | ||
| "SYN.") | ||
| resent = true | ||
|
|
||
| continue handshake | ||
| case <-g.quit: | ||
|
|
@@ -171,6 +178,10 @@ handshake: | |
| return io.EOF | ||
| } | ||
|
|
||
| // Notify the timeout manager we've received the SYN response from the | ||
| // counterparty. | ||
| g.timeoutManager.Received(resp) | ||
|
|
||
| // Send SYNACK | ||
| g.log.Debugf("Sending SYNACK") | ||
| synack, err := new(PacketSYNACK).Serialize() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.