Commit Graph

32 Commits

Author SHA1 Message Date
Mahendra 1a36361ef9
replace all random.xxx with helper random function 2018-03-21 19:26:27 +05:30
Peter Šurda d223bfc6f2
Fix kqueue poller
- separate read and write filters
- make filters peristent for reduced syscall count
2018-01-31 22:25:23 +01:00
Peter Šurda d6df4470e1
No connection CPU hog fix
- the previous fix was incomplete, it shouldn't consume excessive
resources now when there are no connections
2018-01-23 15:59:58 +01:00
Peter Šurda 01c8f3b66d
Fix asyncore CPU usage on no connection
- if there are no connections, asyncore would hog CPU
- thanks to an anonymous contributor
2018-01-22 22:37:29 +01:00
Peter Šurda 4086253730
Bandwidth limit optimisation
- should be slightly more accurate and use slightly fewer resources
2018-01-02 15:24:47 +01:00
Peter Šurda 1864762a0a
Apply bandwidth limits without restart
- also minor style fixes
2018-01-01 12:49:08 +01:00
Peter Šurda 660997b8f4
Code Quality 2017-08-22 13:49:27 +02:00
Peter Šurda 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
Peter Šurda 4564d37f5b
Typo in previous commits 2017-08-06 21:26:25 +02:00
Peter Šurda 38872159fb
Typo in previous commit 2017-08-06 20:40:35 +02:00
Peter Šurda 5895dc2f1f
Asyncore Windows error handling
- windows behaves somewhat differently when using select
2017-08-06 20:39:14 +02:00
Peter Šurda 5108d08ac9
Windows asyncore error handler fix
- WSAEWOULDBLOCK is now checked on connect and accept
2017-08-06 18:18:21 +02:00
Peter Šurda a29f7534ee
Add EINTR handler for select and poll pollers 2017-07-21 09:06:02 +02:00
Peter Šurda 2530c62050
epoll throws IOError rather than select.error 2017-07-21 07:49:34 +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 2685fe29b1
Code quality improvements 2017-06-24 12:13:35 +02:00
Peter Šurda 0cc8589b27
Asyncore updates
- should prevent the same object being re-requested indefinitely
- locking for object tracking
- move SSL-specific error handling to TLSDispatcher
- observe maximum connection limit when accepting a new connection
- stack depth test (for debugging purposes)
- separate download thread
- connection pool init moved to main thread
2017-06-21 12:16:33 +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 e8d9a7f183
Asyncore connect handling
- minor improvements in handling of connect events so that it's not
processed twice
2017-06-03 16:30:05 +02:00
Peter Šurda bdaa939e2c
ENOTSOCK fix 2017-05-29 13:39:26 +02:00
Peter Šurda 97c44b97f4
Asyncore update
- handle WSAENOTSOCK
2017-05-29 13:14:25 +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 21f6d38ec2
Asyncore fixes
- TCP fixes
2017-05-27 21:52:56 +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 fa56ab3e6f
Asyncore update
- better error handling
- bug fixes
- remove some debug output
2017-05-24 21:15:36 +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
Peter Šurda 96d58f3c11
Asyncore update (WIP) 2017-04-16 18:27:15 +02:00
Peter Šurda 46c9ea9403
Async network updates (WIP)
- cleaner command handling
- separating into header and command handling
- incoming connection handler
- bugfixes and more debug information
2017-03-20 18:32:26 +01:00
Peter Šurda 49869d0b56
Networking subsystem updates
- version command struct for faster unpacking
- increase read buffer to 2MB to allow a full command to fit
- initial bitmessage protocol class (WIP)
- error handling
- remove duplicate method
2017-03-11 11:12:08 +01:00
Peter Šurda a1d1114cb2
New network subsystem updates
- auto-select select/poll/epoll/kqueue depending on what's available
2017-03-10 23:56:38 +01:00
Peter Šurda 998935be5f
New network subsystem, WIP
- finished proxy design
- socks4a and socks5 implemented
- authentication not tested
- resolver for both socks4a and socks5
- http client example using the proxy
2017-03-10 23:11:57 +01:00