Commit Graph

22 Commits

Author SHA1 Message Date
Neil Booth
30bb832ef8 Prepare 1.0 2017-03-05 13:22:09 +09:00
Neil Booth
27f94cfb04 Take up to 2 peers randomly from each bucket
Bumped up from 1.
Restore STALE_SECS to 1 day
2017-03-01 20:20:30 +09:00
Neil Booth
39bcdb1b6a Require Python 3.5.3
3.5.2 has various socket and API issues affecting peer discovery

Closes #135
2017-03-01 07:23:11 +09:00
Neil Booth
be9d063457 Rename function 2017-03-01 06:44:38 +09:00
Neil Booth
31b978f21e Remove debug logging and peers semaphore.
Increase STALE_SECS to 4 hrs.  Will revert to 1 day soon.
2017-02-28 07:27:36 +09:00
Neil Booth
ddbc13653f Merge branch 'develop' 2017-02-27 19:20:04 +09:00
Neil Booth
2c1481859f More verbose peer logging
Force more reconnects.  Restrict semaphore to 2.
2017-02-27 19:15:07 +09:00
Neil Booth
e2d640dcb3 Don't announce self if not public
Show all hosts add_peer gives
2017-02-26 15:26:11 +09:00
Neil Booth
0145098165 Add debug output
Idea is to help understand #135
2017-02-26 10:42:32 +09:00
Neil Booth
d36d222489 Maintain more than one self-identity
Rather than just retaining our clearnet identity from the environment,
maintain any tor one as well.  This is a little cleaner and avoids
confusion over port assignment when converting to real names.

Fixes #136
2017-02-26 10:22:22 +09:00
fr3aker
4c8b5a6439 fix tor coin peers always scheduled for check (#139)
fixes #138
2017-02-26 10:16:08 +09:00
Neil Booth
5bcbdea16a Only set last_connect if the connection was good 2017-02-20 05:37:53 +09:00
Neil Booth
5662f1fa88 Add facility to disable peer discovery
and/or self announcement.
2017-02-19 19:02:01 +09:00
Neil Booth
86f6a148b9 Separate async item processor per session
Improve daemon wait logic

Fixes #100
2017-02-19 19:01:41 +09:00
Neil Booth
0149f2785f A few peer handling improvements
based on suggestions from hsmiths
Set transport to None if a connection is lost
Only subscribe to peers if the peer is verified on same network
2017-02-19 10:21:17 +09:00
Neil Booth
3f35bc0298 More PEP8 stuff 2017-02-18 13:05:26 +09:00
Neil Booth
151da40d5b Implement peer discovery protocol
Closes #104

DEFAULT_PORTS now a coin property
A Peer object maintains peer information
Revamp LocalRPC "peers" call to show a lot more information
Have lib/jsonrpc.py take care of handling request timeouts
Save and restore peers to a file
Loosen JSON RPC rules so we work with electrum-server and beancurd which don't follow the spec.
Handle incoming server.add_peer requests
Send server.add_peer registrations if peer doesn't have us or correct ports
Verify peers at regular intervals, forget stale peers, verify new peers or those with updated ports
If connecting via one port fails, try the other
Add socks.py for SOCKS4 and SOCKS5 proxying, so Tor servers can now be reached by TCP and SSL
Put full licence boilerplate in lib/ files
Disable IRC advertising on testnet
Serve a Tor banner file if it seems like a connection came from your tor proxy (see ENVIONMENT.rst)
Retry tor proxy hourly, and peers that are about to turn stale
Report more onion peers to a connection that seems to be combing from your tor proxy
Only report good peers to server.peers.subscribe; always report self if valid
Handle peers on the wrong network robustly
Default to 127.0.0.1 rather than localhost for Python <= 3.5.2 compatibility
Put peer name in logs of connections to it
Update docs
2017-02-18 12:43:45 +09:00
Neil Booth
06c8eda161 Preparations for peer discovery
DEFAULT_PORTS is a now a coin property.
Other miscellaneous updates to get things closer
2017-01-29 06:47:43 +09:00
Neil Booth
e56f188816 Implement peer subscriptions
Incremental updates are passed.
Also implement a server.features RPC
2017-01-25 20:28:19 +09:00
Neil Booth
cb0160901f Unify executor and futures logic 2017-01-24 21:25:37 +09:00
Neil Booth
a7462a6ea3 Complete rewrite of JSON RPC infrastructure
Aim to be easier for clients to use, because to do peer
discovery we must act as a client to other servers.

Split out JSON session concept from the asyncio protocol
concept.  This makes the JSON RPC support more easily
testable and usable as a stand-alone library.

In addition, support JSON RPC v1 and v2, and auto-detection
of peer's version.
2017-01-23 23:36:02 +09:00
Neil Booth
05a6da1920 Move peer management to peers.py from irc
It's cleaner and will be useful for peer-to-peer comms later
2017-01-22 23:34:44 +09:00