-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add API endpoint to disconnect peers #23
Conversation
connmgr.go
Outdated
return errorResponse(err) | ||
} | ||
|
||
d.host.Network().ClosePeer(p) |
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.
ClosePeer returns an error
. It's a synchronous call as it is, so we're going to wait until connections are closed anyway. Can we propagate the error to the caller?
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.
Sure, and we should.
connmgr.go
Outdated
@@ -51,6 +51,15 @@ func (d *Daemon) doConnManager(req *pb.Request) *pb.Response { | |||
d.host.ConnManager().TrimOpenConns(ctx) | |||
return okResponse() | |||
|
|||
case pb.ConnManagerRequest_DISCONNECT_PEER: |
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.
Seems a bit of a misnomer to place this operation in the namespace of ConnManager
? Why not put it in the same namespace as CONNECT
?
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.
Ok, I will move it to top-level.
Moved |
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. A few spacing nits but not important. Might be worth getting a review from @bigs before merge, as he's more involved in the daemon.
Closes #22