Commit Graph

114 Commits

Author SHA1 Message Date
Dmitri Bogomolov cc2fa62b90
Moved most of frequently used SQL-queries to helper_db module. 2021-02-26 22:01:09 +02:00
navjot 9c5d329c90
replace print with logger and remove unused file 2021-01-18 23:31:45 +05:30
Peter Šurda 184664d758
SQL operations asserts and code quality
- complain if trying to execute SQL statements without a running
  `.threads.sqlThread`. This is to give better test feedback if used
  incorrectly
- refactor `.helper_sql.sql_ready` as a `threading.Event`
- code quality
2021-01-01 17:54:05 +01:00
navjot 6c5bb62123
replaced double quotes with Single quotes in class_singleWorker module 2020-10-31 13:07:51 +05:30
navjot a7c1018f47
fixed CQ for src.class_singleWorker module 2020-10-31 13:07:51 +05:30
navjot 30044f7516
implemented filter query in sent table on the bases of folder= 'sent' 2020-10-31 13:07:51 +05:30
Dmitri Bogomolov d56191ebba
Move knownnodes module into network package 2020-07-21 16:21:43 +03:00
Dmitri Bogomolov 0dd49761d0
Populate knownnodes from inventory when singleWorker starts 2020-07-21 16:21:42 +03:00
Dmitri Bogomolov 185ad66ea5
Moved most of variables from shared elsewhere (mostly to state) 2020-05-05 17:27:38 +03:00
lakshyacis 3211fca953
formatting and shorten line length 2020-01-22 15:55:26 +05:30
lakshyacis b6a81f1252
Formatting and fix License 2020-01-15 16:17:26 +05:30
Dmitri Bogomolov 5a35de6bca
Fix sendOnionPeerObj() broken in 9923e97 2019-12-21 13:14:28 +02:00
lakshyacis 9923e97279
class_singleWorker quality fixes 2019-11-25 10:48:35 +05:30
Dmitri Bogomolov 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
Dmitri Bogomolov 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
Dmitri Bogomolov ad2a2b3fb4
Inherit helper_threading.StoppableThread from threading.Thread
and do random.seed() in its __init__
2019-08-06 18:07:19 +03:00
Dmitri Bogomolov 38e5d93272
Resend onionpeer object if it expired while the node ran 2019-06-14 12:38:48 +03:00
Dmitri Bogomolov f868c1ad11
Fixing my bug in 453e045 2019-06-06 09:21:59 +03:00
Dmitri Bogomolov 4a097e99b3
Fixes for @omkar1117 2019-05-10 12:24:47 +03:00
Dmitri Bogomolov 01d4fbe60b
Resolved pylint warnings 2019-05-10 12:24:46 +03:00
Dmitri Bogomolov 453e045ae5
Minimal implementation of onionpeer object 2019-05-10 12:24:41 +03:00
Dmitri Bogomolov 3adadd398f
Removed from shared the functions duplicating protocol:
decryptAndCheckPubkeyPayload, isBitSetWithinBitfield
2019-02-04 22:19:39 +02:00
coffeedogs 0a30eb0225
Changes based on style and lint checks. (final_code_quality_7) 2018-11-12 14:21:56 +00:00
coffeedogs 8979a1bef5
Fixed: Addressed PR comments 2018-05-08 12:53:58 +01:00
coffeedogs c99c3fc782
Fixed: Codacy issues in src/class_*.py 2018-05-03 19:05:39 +01:00
Dmitri Bogomolov 6562502416
Even more unused variables 2018-03-22 13:48:07 +02:00
Dmitri Bogomolov e43bd36618
More unused variables 2018-03-22 13:23:36 +02:00
Dmitri Bogomolov d91c3a6b0c
Removed unnecessary comment and percent formatting in logger.error 2018-03-22 12:13:47 +02:00
Dmitri Bogomolov d447db907c
Address operations: simplified the code a bit 2018-03-22 12:13:47 +02:00
Dmitri Bogomolov 006b98389b
Address operations: flake8 2018-03-22 12:13:47 +02:00
Mahendra 1ad321b08a
replace random.xxx with calls to the helper_random function 2018-03-21 17:22:23 +05:30
Peter Šurda 1e4400a207
Remove obsolete code
- PendingDownload and PendingUpload in inventory.py are obsolete
- the replacement functions only provide lengths and are in
  network/stats.py
2018-03-13 07:32:23 +01:00
f97ada87 be0e724b23
implement stealth ack objects 2017-09-30 19:45:40 +10:00
Peter Šurda a48dff3bee
PoW init reordering
- inited by the worker thread on its own init, instead of when the
imports are being evaluated
- also got rid of windows-style newlines in OpenCL PoW
2017-08-15 12:24:43 +02:00
Peter Šurda 6c695c8ac7
Remove non-asyncore network code (partial) 2017-08-09 17:36:52 +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 73c41bff9d
typo
-BMConfigParser. instead of BMConfigParser().
2017-05-29 02:30:18 +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 9f4a1fa0a4
Config file defaults and address unification
- bmconfigpaser.py now allows to put default values for a specific
option in the file
- addresses as sections are now detected by "BM-" rather than
just ignoring bitmessagesettings. There can now be other sections
with a cleaner config file
2017-05-15 12:18:07 +02:00
Peter Šurda 8d829b587e
Reset OpenCL when settings change
- previously, changing the OpenCL vendor (or turning it on/off) required
  a restart and this wasn't clear
2017-02-28 22:59:44 +01:00
Peter Šurda 511b89ebbe
PoW Worker should wait for sql thread to init
- I think this was causing freezing queue on launch if not empty
- I can't reproduce the bug anymore
2017-02-26 20:44:56 +01:00
Peter Šurda 74c85b4a9e
Retransmit timing changes
- makes it behave more like in the description
- partial for #847
2017-02-25 23:40:37 +01: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 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 5ae1327edc
Download/upload shutdown fixes
- Missing renamed to PendingDownload
- PendingDownload now only retries 3 times rather than 6 to dowload an
  object
- Added PendingUpload, replacing invQueueSize
- PendingUpload has both the "len" method (number of objects not
  uploaded) as well as "progress" method, which is a float from 0
  (nothing done) to 1 (all uploaded) which considers not only objects
  but also how many nodes they are uploaded to
- PendingUpload tracks when the object is successfully uploaded to the
  remote node instead of just adding an arbitrary time after they have
  been send the corresponding "inv"
- Network status tab's "Objects to be synced" shows the sum of
  PendingUpload and PendingDownload sizes
2017-01-19 19:48:12 +01:00
Peter Šurda 8cb0953401
Moved writeKeysFile into configparser
- shared.writeKeysFile -> BMConfigParser().save
- makes it easier to get rid of circular imports
2017-01-15 10:50:02 +01:00
Peter Šurda ad75552b5c
Move shutdown from shared.py to state.py 2017-01-14 23:20:15 +01:00
Peter Šurda 2cf2188bc3
Object sending fix
- forgot to move broadcastToSendDataQueues in class_singleWorker.py
2017-01-12 07:22:34 +01:00
Peter Šurda e7470a4757
Remove leftover from debugging 2017-01-12 06:57:17 +01:00