Commit Graph

54 Commits

Author SHA1 Message Date
391b5ded87
Docstrings in network from #1368 2019-07-26 12:08:32 +03:00
19ab56a979
network.connectionpool: get any setting with .safeGet.. 2019-07-26 12:08:18 +03:00
996e71ae6f
flake8 in network package 2019-07-26 12:07:57 +03:00
e1d5604674
Fix #1408 (duplicate connections to some hosts), got from chan 2018-12-18 19:36:46 +02:00
ef54bcaf82
The changes in #1325 are buggy. Implementing it properly. 2018-10-12 11:28:13 +03:00
342e2a209c
Use DNS seed only if knownnodes are empty 2018-07-30 17:39:12 +03:00
Mahendra
1a36361ef9
replace all random.xxx with helper random function 2018-03-21 19:26:27 +05:30
03f08b3cfd
Typo 2018-02-04 21:16:30 +01:00
a646ec4902
Allow separate proxy for onions
- new options in network section: onionsocksproxytype,
onionsockshostname and onionsocksport. These allow to separate
connectivity types for onion and non-onion addresses, e.g. connect to
clear nodes over clearnet and onions over tor
- also remove some obsolete imports
2018-02-04 21:03:54 +01:00
fd1a6c1fa1
Dandelion update
- dandelion fixes
- try to wait as long as possible before expiration if there are no
outbound connections
- expire in invThread rather than singleCleaner thread
- deduplication of code in inv and dinv command methods
- turn on by default, seems to work correctly now
- turn off dandelion if outbound connections are disabled
- start tracking downloads earlier, and faster download loop
- remove some obsolete lines
- minor PEP8 updates
2018-02-03 11:46:39 +01:00
68b58ce0c5
Download optimisation
- new data structure to handle download tracking, uses less CPU
2018-02-01 12:19:39 +01:00
9e79386595
Set state to "close" and call handle_close() for all connections 2018-01-30 14:04:03 +02:00
c9851b9f41
Connection lookups invalid data handling
- shouldn't throw an exception if argument is a string rather than Peer
2018-01-02 22:23:03 +01:00
1864762a0a
Apply bandwidth limits without restart
- also minor style fixes
2018-01-01 12:49:08 +01:00
fdfbb77ed2
Close filehandles on connection reaping
- I thought this is done automatically through garbage collection, but I
think as the channel is still assigned in the asyncore map, it needs
to be done manually. Basically filehandle limit exceeded and it
crashed
2017-11-19 00:05:55 +01:00
5e042b76e7
Typo
- missing brackets
2017-11-18 10:05:41 +01:00
3aa6f386db
Dandelion fixes
- dandelion would always think there is a cycle and trigger fluff
- cycle fluff trigger didn't correctly re-download and re-announce the
object. Now it remembers between (d)inv and object commands that it's
in a fluff trigger phase.
2017-11-18 09:47:17 +01:00
3c3d69e5de
Reap closed connection fix 2017-11-17 19:50:39 +01:00
5a787f41d2
Socket closing changes
- explicit close only through asyncore error handler
- implicit close through garbage collector
- avoid duplicate closing
2017-11-17 13:37:51 +01:00
1792289e00
close handling fix
- don't close a connection twice
2017-11-14 23:43:05 +01:00
2d34e73648
Dandelion updates
- fixes and feedback from @gfanti and @amiller
- addresses #1049
- minor refactoring
- two global child stems with fixed mapping between parent and
child stem
- allow child stems which don't support dandelion
- only allow outbound connections to be stems
- adjust stems if opening/closing outbound connections (should
allow partial dandelion functionality when not enough outbound
connections are available instead of breaking)
2017-10-20 01:21:49 +02:00
391d40d78b
Socket closing changes
- closing reason moved to a variable
- actual closing now done in asyncore thread instead of
receivedata thread
2017-10-19 09:08:05 +02:00
333170b172
Dandelion fixes
- more exception handling
- only use outbound connections for stems
(thanks to @amillter for info)
- don't create stems if config disabled
- addresses #1049
2017-10-06 16:33:44 +02:00
9923d288e0
Dandelion fixes
- in route selector, some connections may not have the services
attribute (yet)
- Addresses #1049
2017-09-25 09:17:15 +02:00
d574b167d8
Dandelion updates & fixes
- Addresses #1049
- Add dandelion routes for locally generated objects
- Minor bugfixes
- Send dinv commands on stem objects (instead of always sending inv
command)
2017-09-25 08:49:21 +02:00
6ce86b1d0a
Dandelion++ implementation
- untested, some functionality may be missing, don't turn on
- also, it randomises upload of requested objects
- affects #1049
2017-09-25 01:17:04 +02:00
1881bcea68
Don't connect on first start until approved 2017-09-21 18:18:42 +02:00
e7231f3aea
Fix multiple TCP bind address handling 2017-08-09 23:30:22 +02:00
0b07b1c89a
Peer discovery updates
- allow loopback addresses, now you can bind different loopback IP
addresses on a single system and they will auto-cross-connect
- always listen for discovery on 0.0.0.0
- [network] - bind now also applies for the TCP socket as well as UDP
socket
- closing socket iterator fix
2017-08-09 17:34:47 +02:00
e071efac1a
Typo 2017-08-09 17:29:48 +02:00
cc955cd69d
Try new ports of binding fails
- API and BM protocol will try random ports for binding if those
configured are occupied
2017-08-09 17:29:23 +02:00
0324958e92
Peer discovery fixes
- incoming packets weren't correctly processed
2017-08-06 23:05:54 +02:00
3941b39136
Randomise node id
- in order to detect if it's connected to to itself, PyBitmessage now
uses a per-connection id rather than a global one
2017-07-10 07:10:05 +02:00
4fce01e34a
Less data transferred in invThread and addrThread 2017-07-08 18:02:47 +02:00
ba4162d7fe
Asyncore update
- get rid of per-connection writeQueue/receiveQueue, and instead use
strings and locking
- minor code cleanup
- all state handlers now should set expectBytes
- almost all data processing happens in ReceiveDataThread, and
AsyncoreThread is almost only I/O (plus TLS). AsyncoreThread simply
puts the connection object into the queue when it has some data for
processing
- allow poll, epoll and kqueue handlers. kqueue is untested and
unoptimised, poll and epoll seem to work ok (linux)
- stack depth threshold handler  in decode_payload_content, this is
recursive and I think was causing occasional RuntimeErrors. Fixes #964
- longer asyncore loops, as now data is handled in ReceiveDataThread
- randomise node order when deciding what to download. Should prevent
retries being stuck to the same node
- socks cleanup (socks5 works ok, socks4a untested but should work too)
2017-07-06 19:45:36 +02:00
fc19e4119a
Download thread updates
- now tracks downloads globally too, so it doesn't request the same
object from multiple peers at the same time
- retries at the earliest every minute
- stops trying to download an object after an hour
- minor fixes in retrying downloading invalid objects
2017-07-05 09:25:49 +02:00
a0bbd21efc
Add ratings to peers
- outbound peers now have a rating
- it's also shown in the network status tab
- currently it's between -1 to +1, changes by 0.1 steps and uses a
hyperbolic function 0.05/(1.0 - rating) to convert rating to
probability with which we should connect to that node when randomly
chosen
- it increases when we successfully establish a full outbound connection
to a node, and decreases when we fail to do that
- onion nodes have priority when using SOCKS
2017-07-05 09:17:01 +02:00
916b85c862
Connection pool cleanup
- minor code quality improvement
2017-06-24 12:23:16 +02:00
2685fe29b1
Code quality improvements 2017-06-24 12:13:35 +02:00
a3a55e53c4
UDP Socket dict address fix
- fixes #1008
2017-06-11 14:11:39 +02:00
cba749088a
Asyncore updates
- mainly work on proxy support, but it's still not fully working
- minor bugfixes
2017-06-10 10:13:49 +02:00
d75d920a68
Asyncore updates
- clean object tracking dictionaries in the cleaner thread
- clean up close / handle_close
- add locking to tracking dictionaries
2017-06-02 07:09:35 +02:00
4c17a18006
Don't send invs to unestablished connections 2017-05-31 23:34:06 +02:00
d9e3349eeb
Fix own IP detection
- minor bug in the previous commit
2017-05-31 00:22:07 +02:00
f23c169eec
Don't connect to myself
- track local IP+port of incoming connections and don't connect
to them in the future
2017-05-31 00:04:21 +02:00
fa9811f426
Asyncore update
- duplicate checking implemented
- connection pool vs. socket closing cleanup
2017-05-30 23:53:43 +02:00
7f381c0c25
Asyncore update
- incoming object handling fix
2017-05-29 14:52:31 +02:00
a5c1b0c529
Asyncore fixes
- better handling of WSA* checks on non-windows systems
- handle EBADF on Windows/select
- better timeouts / loop lengths in main asyncore loop and
spawning new connections
- remove InvThread prints
2017-05-29 12:56:59 +02:00
c85d52b8e8
Asyncore updates
- asyncore is now on by default
- inv announcements implemented
- bandwidth limit implemented / fixed
- stats on download / upload speed now work
- make prints into logger
- limit knownNodes to 20k as it was before
- green light fixed
- other minor fixes
2017-05-29 00:24:07 +02:00
f8b4b427fc
Asyncore update
- bugfixes
- UDP socket for local peer discovery
- new function assembleAddr to unify creating address command
- open port checker functionality (inactive)
- sendBigInv is done in a thread separate from the network IO
thread
2017-05-27 19:09:21 +02:00