Commit Graph

344 Commits

Author SHA1 Message Date
Dmitri Bogomolov 46f5ead960
Import email related stuff only if configured 2018-06-27 12:27:46 +03:00
Dmitri Bogomolov 953ea4e950
Slightly rewritten bitmessagemain to use depends properly 2018-06-27 01:27:37 +03:00
Dmitri Bogomolov f87ce4ad50
Moved reading knownnodes.dat into knownnodes module 2018-05-21 18:49:38 +03:00
Dmitri Bogomolov 4cf73675c2
flake8: bitmessagemain, class_singleCleaner, helper_generic, shutdown
and singleinstance
2018-05-21 13:37:23 +03:00
f97ada87 54651c7598
fix logic bug in enableGUI implementation 2018-04-13 20:16:00 +10:00
f97ada87 cb59b8abbd
component control switches 2018-04-09 15:03:02 +10:00
Dmitri Bogomolov 43a471a79b
Used state.testmode to indicate when operating in test mode 2018-04-05 13:48:13 +03:00
Dmitri Bogomolov 58c3dfb3d4
Testing mode for bitmessagemain 2018-03-29 15:55:28 +03:00
Peter Šurda 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
Dmitri Bogomolov 61ddc1208e
No more shared.daemon variable 2018-01-25 12:58:29 +02:00
Peter Šurda d9a4263083
Daemonising fixes
- change forking exit order as systemd expects (wait until child is
ready, then exit parent, then grandparent)
- fix signal handler if prctl not installed
- revert recent PID file changes
2018-01-01 13:08:12 +01:00
Peter Šurda 3cb9547389
Only write PID after last fork
- should fix systemd integration
2017-12-21 14:26:51 +01:00
Peter Šurda 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
f97ada87 08748fa9ae
move config read inside main function 2017-09-27 00:36:43 +10:00
Peter Šurda 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
f97ada87 c89d86a779
use getopt parser for command-line arguments 2017-09-24 07:42:37 +10:00
Peter Šurda aaa5e9d309
Windows daemon mode workaround 2017-09-23 18:25:41 +02:00
Peter Šurda 0150a35dd4
Change main thread name to PyBitmessage 2017-09-21 17:51:34 +02:00
Peter Šurda 660997b8f4
Code Quality 2017-08-22 13:49:27 +02:00
Peter Šurda b886f935d4
Daemon Windows fix
- closing the filehandle isn't the correct approach, it causes more
bugs. Use os.devnull instead
2017-08-20 12:05:53 +02:00
Peter Šurda 314af0925f
Daemonize fix for Windows
- /dev/null isn't available on Windows so just close the console
sockets directly
2017-08-20 11:55:54 +02:00
Peter Šurda 58b47bc6de
Forking fixes 2017-08-15 12:22:24 +02:00
Peter Šurda 6c695c8ac7
Remove non-asyncore network code (partial) 2017-08-09 17:36:52 +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 7a4551e1e7
Fix signal handler in daemon mode
- signal handler requires the main thread to run
2017-07-30 09:36:20 +02:00
Peter Šurda 501f07dd34
Setsid is not available on Windows
- wrap an error handler around it
2017-07-28 09:19:53 +02:00
Peter Šurda 20cbac9752
Fix daemonize for Windows
Fixes #1034
2017-07-28 08:54:34 +02:00
Peter Šurda bdf61489ae
Allow multiple ReceiveQueue threads
- defaults to 3
2017-07-10 07:08:10 +02:00
Peter Šurda 4536e44b8c
Thread names propagate to system
- the thread names should now show up in the monitoring tools of
operating systems (tested on linux)
2017-07-06 19:35:40 +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 e00a02206b
AddrThread
- this thread is for spreading new/updated addresses in active
connections, analogous to the InvThread
- it doesn't do anything yet, this is just a dummy queue at the moment
2017-07-05 08:57:44 +02:00
Peter Šurda 2685fe29b1
Code quality improvements 2017-06-24 12:13:35 +02:00
Peter Šurda 618f3865c1
Main thread end
- instead of sleeping, it just ends
2017-06-21 12:16:56 +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 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 02a07e5119
Asyncore update
- default to true (original attempt didn't work correctly)
2017-05-29 03:16:14 +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 d699a28e49
Add variables to errno and socket
- to make sure they work cross platform without having to do
complicated tests
2017-05-27 19:00:19 +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 51e52401fe
Windows plaform check pythonic
- moved to .startswith instead of 'in'
- thanks @Lvl4sword
2017-05-25 15:00:10 +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
Dmitri Bogomolov 34084bbc80
Total setup.py cleanup and simple script installation 2017-02-28 15:51:49 +02:00
Peter Šurda 6062277d60
Rename configparser.py to bmconfigparser.py
- it was causing problems with py2app because the source of python's own
  CongigParser is also configparser.py
2017-02-22 09:34:54 +01:00
Peter Šurda e664746f04
More knownNodes init
- also init children if they are missing
2017-02-08 20:52:18 +01:00
Peter Šurda 35a712d11d
KnownNodes missing init
- init knownnodes when connecting to a stream
2017-02-08 20:48:22 +01:00
Peter Šurda 157881bc63
Cyclic import fix
- networkDefaultProofOfWorkNonceTrialsPerByte and
  networkDefaultPayloadLengthExtraBytes cyclic import fix
- PyBitmessage should launch now when there's no keys.dat
2017-02-08 20:37:42 +01:00
Peter Šurda 59f3a2fbe7
Reduce cyclic dependencies
- rearranged code to reduce cyclic dependencies
- doCleanShutdown is separated in shutdown.py
- shared queues are separated in queues.py
- some default values were moved to defaults.py
- knownnodes partially moved to knownnodes.py
2017-02-08 13:41:56 +01:00
Peter Šurda f6bdad18a3
Improved stream handling
- version command sends list of all participating streams
- biginv sends lists of hosts for all streams the peer wants (plus
  immediate children)
- objects will spread to all peers that advertise the associated stream
- please note these are just network subsystem adjustments, streams
  aren't actually usable yet
2017-02-06 17:47:05 +01:00
Peter Šurda 4f70eaa01f
Fix curses mode 2017-02-02 15:48:56 +01:00