-
Notifications
You must be signed in to change notification settings - Fork 55
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
Autonat service #814
Autonat service #814
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #814 +/- ##
============================================
- Coverage 83.62% 83.59% -0.03%
============================================
Files 81 82 +1
Lines 14726 14910 +184
============================================
+ Hits 12314 12464 +150
- Misses 2412 2446 +34
|
5014cd6
to
5f7cbd2
Compare
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.
looks great, just some minor comments.
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.
lgtm! thanks!
36cf4cf
to
a4999bf
Compare
b166ae1
to
c36fbb2
Compare
libp2p/services/autonatservice.nim
Outdated
method setup*(self: AutonatService, switch: Switch): Future[bool] {.async.} = | ||
let hasBeenSettedUp = await procCall Service(self).setup(switch) | ||
if hasBeenSettedUp: | ||
self.newConnectedPeerHandler = proc (peerId: PeerId, event: PeerEvent): Future[void] {.async.} = | ||
discard askPeer(self, switch, peerId) | ||
switch.connManager.addPeerEventHandler(self.newConnectedPeerHandler, PeerEventKind.Joined) | ||
if self.scheduleInterval.isSome(): | ||
self.registerLoop = register(self, switch, self.scheduleInterval.get()) | ||
return hasBeenSettedUp | ||
|
||
method run*(self: AutonatService, switch: Switch) {.async, public.} = | ||
await askConnectedPeers(self, switch) | ||
|
||
method stop*(self: AutonatService, switch: Switch): Future[bool] {.async, public.} = | ||
let hasBeenStopped = await procCall Service(self).stop(switch) | ||
if hasBeenStopped: | ||
if not isNil(self.registerLoop): | ||
self.registerLoop.cancel() | ||
self.registerLoop = nil | ||
if not isNil(self.newConnectedPeerHandler): | ||
switch.connManager.removePeerEventHandler(self.newConnectedPeerHandler, PeerEventKind.Joined) | ||
return hasBeenStopped |
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.
This is very confusing, to refacto during the service rework
e5fc20b
to
bd8ec0b
Compare
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.
Only minor tweaks left, overall LGTM!
3b6bbcb
to
6d95519
Compare
This a service which uses the Autonat protocol to estimate a node network reachability on the internet.