Bitcoin Forum
September 27, 2018, 10:00:10 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Instructing a node to disconnect from a specific peer via RPC  (Read 977 times)
statoshi
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile WWW
September 12, 2014, 01:02:18 PM
 #1

I'm working on a daemon to manage peer connections across multiple nodes but seem to have hit a wall when it comes to instructing a node to disconnect from a peer. I have succeeded in using the 'addnode' command to get my nodes to connect to specific peers, but apparently using the 'remove' option does not force a disconnect from the peer.

Is there any way for me to achieve peer disconnects via the RPC API?

If not, would it make sense for me to submit a pull request to add a 'disconnect' option to the 'addnode' RPC call?
1538085610
Hero Member
*
Offline Offline

Posts: 1538085610

View Profile Personal Message (Offline)

Ignore
1538085610
Reply with quote  #2

1538085610
Report to moderator
1538085610
Hero Member
*
Offline Offline

Posts: 1538085610

View Profile Personal Message (Offline)

Ignore
1538085610
Reply with quote  #2

1538085610
Report to moderator
1538085610
Hero Member
*
Offline Offline

Posts: 1538085610

View Profile Personal Message (Offline)

Ignore
1538085610
Reply with quote  #2

1538085610
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 1014


Chief Scientist


View Profile WWW
September 15, 2014, 12:29:24 PM
 #2

I needed that, so hacked together a disconnectpeer RPC call:
  https://github.com/gavinandresen/bitcoin-git/commit/499ae0b3d77e1c41d79f34329d555980676d1f3a

Needs more thorough testing-- I'm not sure if calling CloseSocketDisconnect directly from the RPC thread is the cleanest way of disconnecting a peer.

How often do you get the chance to work on a potentially world-changing project?
statoshi
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile WWW
September 15, 2014, 12:33:00 PM
 #3

Excellent. I added in the functionality over the weekend and the only way that seemed appropriate was to call CloseSocketDisconnect(), but I'm not nearly as familiar with the codebase as you!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!