-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Handle incoming conns in their own goroutines #35
Conversation
Doing the multistream negotiation in sync causes hanging issues. This commit accepts transport connections and starts the negotiation in a separate goroutine, sending it down a channel when its ready.
} | ||
|
||
c.Close() | ||
<-done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good basic test case. but we need a stronger stress tests. something like:
- start off N (=1000) goroutines, all hang for ~20ms, then continue. measure that they all complete async (within < 2s, instead of serially N * 20 = 20s)
- start off N (=1000) goroutines, hang half of them until timeout. the others should complete shortly after kicking off.
- start off N (=1000) goroutines, dial, hang for some (1-10)ms , complete them. check listener goroutines are all closed properly (i.e. total goroutines << N)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hanging to timeout is important. can decrease the tiemeout for test, or mock it out with a channel to verify things make forward progress correctly
if took > limit { | ||
t.Fatal("took too long!") | ||
} | ||
log.Errorf("took: %s (less than %s)", took, limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to call wg.Wait()
before exiting this function.
Thanks for handling the changes. This is pretty close. couple things left above o/ |
"author": "whyrusleeping", | ||
"name": "gorocheck", | ||
"hash": "QmWBTBj2ceC8gk2pS5scr4WwuHGrzsTkUnPpv1KPhYET57", | ||
"version": "0.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be great to have the "pkg repo" (individual pkg repo where you can report issues) listed in gx to get it from stored here. this could be a link, http for now and ipns name in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could do that, thats a good idea.
I tried running tests locally on go 1.6 and:
|
passes fine for me in 1.5.3. Looks like gorocheck doesn't account something new in 1.6? |
alright, this LGTM. gonna ship and get it into go-ipfs |
|
55722da
to
261b113
Compare
* Single goroutine managing autonat-relevent events. * Watching incoming connections and local interface changes as signals. * Emit a single 'rechabilitychanged' persistent event fix #40 fix #36 fix #35 fix #34 fix #11 obsolete #28 obsolete #9 Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com> Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
chore: update go-log to v2
fix deadlock in the transport's serve function
Doing the multistream negotiation in sync causes hanging issues.
This commit accepts transport connections and starts the negotiation
in a separate goroutine, sending it down a channel when its ready.