Commit Graph

23 Commits

Author SHA1 Message Date
Peter Šurda 0324958e92
Peer discovery fixes
- incoming packets weren't correctly processed
2017-08-06 23:05:54 +02:00
Peter Šurda 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
Peter Šurda 4fce01e34a
Less data transferred in invThread and addrThread 2017-07-08 18:02:47 +02:00
Peter Šurda 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
Peter Šurda 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
Peter Šurda 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
Peter Šurda 916b85c862
Connection pool cleanup
- minor code quality improvement
2017-06-24 12:23:16 +02:00
Peter Šurda 2685fe29b1
Code quality improvements 2017-06-24 12:13:35 +02:00
Peter Šurda a3a55e53c4
UDP Socket dict address fix
- fixes #1008
2017-06-11 14:11:39 +02:00
Peter Šurda 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
Peter Šurda 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
Peter Šurda 4c17a18006
Don't send invs to unestablished connections 2017-05-31 23:34:06 +02:00
Peter Šurda d9e3349eeb
Fix own IP detection
- minor bug in the previous commit
2017-05-31 00:22:07 +02:00
Peter Šurda 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
Peter Šurda fa9811f426
Asyncore update
- duplicate checking implemented
- connection pool vs. socket closing cleanup
2017-05-30 23:53:43 +02:00
Peter Šurda 7f381c0c25
Asyncore update
- incoming object handling fix
2017-05-29 14:52:31 +02:00
Peter Šurda 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
Peter Šurda 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
Peter Šurda 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
Peter Šurda e309a1edb3
Asyncore update
- separate queue for processing blocking stuff on reception
- rewrote write buffer as a queue
- some addr handling
- number of half open connections correct
2017-05-25 23:04:33 +02:00
Peter Šurda 9683c879bc
Asyncore update
- Network status UI works but current speed isn't implemented yet
- Track per connection and global transferred bytes
- Add locking to write queue so that other threads can put stuff
there
- send ping on timeout (instead of closing the connection)
- implement open port checker (untested, never triggered yet)
- error handling on IO
2017-05-25 14:59:18 +02:00
Peter Šurda bafdd6a93a
Allow making outbound connections in asyncore 2017-05-24 16:54:33 +02:00
Peter Šurda d635e515b9
Big Asyncore update
- most of the stuff is done so it partially works
- disabled pollers other than select (debugging necessary)
- can switch in the settings, section network, option asyncore (defaults
to False)
2017-05-24 16:51:49 +02:00