Commit Graph

65 Commits

Author SHA1 Message Date
d56191ebba
Move knownnodes module into network package 2020-07-21 16:21:43 +03:00
185ad66ea5
Moved most of variables from shared elsewhere (mostly to state) 2020-05-05 17:27:38 +03:00
lakshyacis
6f35da4096
Imported packages sequencing and formatting 2020-01-30 12:14:40 +05:30
lakshyacis
80b2bc1c9a
class_singleCleaner.py quality fixes 2019-11-25 10:48:29 +05:30
7a1f803c92
network.BMConnectionPool: added shortcuts connections()
and establishedConnections(), some formatting fixes
2019-11-11 12:03:04 +02:00
341651973a
Reduced imports:
- exported from network package all objects used outside;
  - made all threads available in threads module.

Wrote some module docstrings.
2019-11-11 12:03:03 +02:00
7a89109fc9
New logging approach in order to reduce imports from submodules
and use logging without risk of circular import. Only subpackage
that imports from debug is bitmessageqt - because it also uses
debug.resetLogging().
Instead of from debug import logger is now recommended to use:

import logging

logger = logging.getLogger('default')

All subclasses of StoppableThread now have a logger attribute.
All threading related stuff except for set_thread_name()
was moved from helper_threading to network.threads.

Fixed two my mistakes from previous edit of debug in a1a8d3a:

 - logger.handlers is not dict but iterable
 - sys.excepthook should be set unconditionally
2019-10-18 09:35:24 +03:00
b5df242141
Fixed badly formatted docstrings and some wrong text 2019-10-18 01:06:02 +03:00
ad2a2b3fb4
Inherit helper_threading.StoppableThread from threading.Thread
and do random.seed() in its __init__
2019-08-06 18:07:19 +03:00
38e5d93272
Resend onionpeer object if it expired while the node ran 2019-06-14 12:38:48 +03:00
e417b6257f
Fixes #1335:
- moved knownnodes cleanup to knownnodes module,
  - added a check for last node in stream initiating DNS based bootstrap.
2018-10-10 14:14:02 +03:00
4cf73675c2
flake8: bitmessagemain, class_singleCleaner, helper_generic, shutdown
and singleinstance
2018-05-21 13:37:23 +03:00
coffeedogs
c99c3fc782
Fixed: Codacy issues in src/class_*.py 2018-05-03 19:05:39 +01:00
f97ada87
cb59b8abbd
component control switches 2018-04-09 15:03:02 +10: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
61ddc1208e
No more shared.daemon variable 2018-01-25 12:58:29 +02:00
0c4d4de82f
Changed the daemon check approach in other places, where it makes sense 2018-01-17 13:58:37 +02:00
44dd08a228
Remove obsolete code in cleaner thread 2017-11-22 21:13:35 +01:00
6ca3460090
Put garbage collection into the cleaner thread
- this maybe addresses #1079
2017-11-22 14:49:18 +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
d44c6c6464
Forget known nodes with bad rating 2017-10-19 08:52:44 +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
d9e4f2ceb8
Typo in previous commit 2017-08-06 21:38:23 +02:00
f338c00f8e
Change peer discovery tracking from queue to a dict
- with a queue, a situation could occur when new entries are appended
but nothing is polling the queue
2017-08-06 21:29:54 +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
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
e7525d47be
Disable memory usage logging
- it looks like it's Unix specific and doesn't work on windows
2017-05-29 11:26:56 +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
7b9b7504ad
Don't clean right on startup 2017-05-27 19:01:14 +02:00
913b401dd0
PendingDownloadQueue updates
- track pending hashId more accurately
- add timeout and a cleanup so that the download queues don't
get stuck and memory is freed
- randomise download order (only works for inv commands with
more than 1 entry)
2017-03-20 01:22:37 +01:00
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
c778b81427
knownNodes refactoring and shutdown fixes
- saveKnownNodes replaced the repeated pickle.dump
- with knownNodesLock instead of acquire/release
- outgoingSynSender had an unnecessary loop during shutdown causing
  excessive CPU usage / GUI freezing
2017-02-09 11:53:33 +01:00
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
e434825bb2
Pending download counter fix
- handles expired objects better
- counts objects that failed download more accurately
2017-02-06 11:02:03 +01:00
ba130e03e5
Network subsystem freezing fixes
- queues were too short
- some error handling was missing
- remove nonblocking repeats in receive data thread
- singleCleaner shouldn't wait unnecessarily
2017-02-02 15:52:32 +01:00
ad75552b5c
Move shutdown from shared.py to state.py 2017-01-14 23:20:15 +01:00
ac348e4e6b
Fixes and refactoring
- fixes errors introduced in the earlier refactoring
- more variables moved to state.py
- path finding functions moved to paths.py
- remembers IPv6 network unreachable (in the future can be used to skip
  IPv6 for a while)
2017-01-11 17:00:00 +01:00
8bcfe80ad0
Refactoring of config parser and shared.py
- got rid of shared config parser and made it into a singleton
- refactored safeConfigGetBoolean as a method of the config singleton
- refactored safeConfigGet as a method of the config singleton
- moved softwareVersion from shared.py into version.py
- moved some global variables from shared.py into state.py
- moved some protocol-specific functions from shared.py into protocol.py
2017-01-11 14:27:19 +01:00
e84b19613e
Inventory refactoring
- minor refactoring, made it into singleton instead of a shared global
  variable. This makes it a little bit cleaner and moves the class into
a separate file
- removed duplicate inventory locking
- renamed singleton.py to singleinstance.py (this is the code that
  ensures only one instance of PyBitmessage runs at the same time)
2017-01-10 21:15:35 +01:00
8df8d15cba
Keep known nodes for 28 instead of 2 days 2016-08-21 07:28:33 +02:00
ca297cafed
Delete old nodes
- cleanup will delete nodes that are older than 3 days
2016-06-15 18:45:23 +02:00
mailchuck
9edde110a2 Translation update
Some function calls were not being identified as text that should be
translated.
2016-05-02 15:00:26 +02:00
mirrorwish
554627dd92 Refactor Inventory 2016-05-02 15:00:25 +02:00
mailchuck
d69c2e097f Cleaner shutdown
Addresses Bitmessage#549
2016-05-02 15:00:21 +02:00
mailchuck
231219a193 Improved logging
Fixes #118

- changed almost all "print" into logger
- threads have nicer names
- logger can have configuration in "logger.dat" in the same directory as
"keys.dat", and the logger will pick the one named "default" to replace
the "console" and "file" that are in PyBitmessage otherwise

Example file for logging to syslog:

[loggers]
keys = root,syslog

[logger_root]
level=NOTSET
handlers=syslog

[logger_syslog]
level=DEBUG
handlers=syslog
qualname=default

[handlers]
keys = syslog

[handler_syslog]
class = handlers.SysLogHandler
formatter = syslog
level = DEBUG
args=(('localhost', handlers.SYSLOG_UDP_PORT),
handlers.SysLogHandler.LOG_LOCAL7)

[formatters]
keys = syslog

[formatter_syslog]
format=%(asctime)s %(threadName)s %(filename)s@%(lineno)d %(message)s
datefmt=%b %d %H:%M:%S
2016-05-02 15:00:21 +02:00
Jonathan Warren
cc712cb8ff finished work on specifyTTL 2015-03-09 02:35:32 -04:00
Jonathan Warren
c306062282 Bitmessage Protocol Version Three 2014-08-27 03:14:32 -04:00
Jonathan Warren
d72e9c1015 add missing import 2014-01-20 13:45:21 -05:00
Jonathan Warren
c490f63170 further work on 'messages expire' feature 2013-11-05 23:22:51 -05:00
Jonathan Warren
bd2803bebc various changes to 'messages expire' pull request 2013-11-04 02:05:07 -05:00