recent changes

This commit is contained in:
surbhicis 2021-10-29 13:08:11 +05:30
parent f6a6d96a07
commit b880e91997
Signed by untrusted user: surbhicis
GPG Key ID: 48A8C2D218DE7B0B
10 changed files with 180 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="793.70081"
height="1122.5197"
id="svg2"
version="1.1"
inkscape:version="0.92.1 r"
sodipodi:docname="can-icon.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.70710678"
inkscape:cx="334.69166"
inkscape:cy="669.88172"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1301"
inkscape:window-height="744"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g3096"
transform="translate(10.559462,156.88343)">
<path
style="fill:#e6e6e6;fill-rule:evenodd;stroke:#241c1c;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
d="M 55.39264,532.81707 342.36431,41.508115 C 438.76759,-31.483548 745.9833,178.54104 718.72589,265.9098 L 453.97326,771.38082 C 513.19721,665.35571 140.41673,439.89351 55.39264,532.81707 Z"
id="path2391"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
inkscape:connector-curvature="0"
id="path3111"
d="M 395.54691,28.063323 112.5256,508.60245"
style="fill:#808080;stroke:#000000;stroke-width:1.64679658px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.11949684"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
inkscape:connector-curvature="0"
id="path2997"
d="M 193.26809,521.672 466.89638,43.16174"
style="fill:none;stroke:#000000;stroke-width:1.65778315px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.06918239"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
inkscape:connector-curvature="0"
id="path3777"
d="M 283.66518,559.54595 549.75376,77.722668"
style="fill:#b3b3b3;stroke:#000000;stroke-width:1.65072334px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.07547171"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
inkscape:connector-curvature="0"
id="path3787"
d="M 442.34039,696.99151 701.70079,210.05539"
style="fill:none;stroke:#000000;stroke-width:1.65072334px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.21383649"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#e6e6e6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 393.66782,26.589965 c -19.64834,0.192 -36.82244,4.5488 -50.17969,14.0606 L 55.837742,532.19937 c 12.78728,-13.4059 31.76749,-19.932 54.652348,-20.9707 L 395.86118,26.595865 c -0.73275,-0.0042 -1.46728,-0.013 -2.19336,-0.0059 z"
id="path2391-6"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#ececec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 395.86314,26.595875 110.49009,511.22867 c 23.70053,-1.076 51.57709,3.7251 81.08008,12.8555 L 467.65416,40.365375 c -25.63117,-8.6186 -50.14818,-13.6453 -71.79102,-13.7695 z"
id="path2391-9"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#e6e6e6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 467.65416,40.363375 191.57017,524.08417 c 29.57345,9.1522 60.77051,22.6569 91.02735,38.9335 L 549.75181,77.724775 c -27.23349,-15.3782 -55.27046,-28.3405 -82.09765,-37.3614 z"
id="path2391-2"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#e6e6e6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 549.75376,77.722668 282.59752,563.01767 c 47.65328,25.635 92.95914,58.1483 125.85154,91.4453 l 262.54485,-485.375 c -31.6082,-32.5347 -75.25565,-65.3989 -121.24015,-91.365302 z"
id="path2391-0"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#cccccc;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 670.99391,169.08797 -262.5469,485.375 c 13.9989,14.1711 25.7445,28.479 34.4707,42.457 l 260.3145,-488.3418 c -8.2409,-12.7677 -19.2291,-26.0995 -32.2383,-39.4902 z"
id="path2391-36"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<path
style="fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 703.23221,208.57817 442.91971,696.9219 c 14.5278,23.2712 20.6735,45.6196 14.8555,64.8692 l 260.8496,-496.57623 c 4.4659,-15.7747 -1.7012,-35.4253 -15.3926,-56.6367 z"
id="path2391-62"
inkscape:connector-curvature="0"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
<ellipse
transform="matrix(0.85942572,0.51126062,-0.48882326,0.87238284,0,0)"
id="path2992"
style="fill:#000000;stroke-width:1.6510005"
cx="541.95758"
cy="429.53775"
rx="232.96017"
ry="92.650627"
inkscape:export-xdpi="4.57552"
inkscape:export-ydpi="4.57552" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -30,6 +30,7 @@ import time
import traceback import traceback
import defaults import defaults
import helper_sql
import shared import shared
import shutdown import shutdown
import state import state
@ -85,6 +86,7 @@ def signal_handler(signum, frame):
class Main(object): class Main(object):
"""Main PyBitmessage class""" """Main PyBitmessage class"""
def start(self): def start(self):
import pdb;pdb.set_trace()
"""Start main application""" """Start main application"""
# pylint: disable=too-many-statements,too-many-branches,too-many-locals # pylint: disable=too-many-statements,too-many-branches,too-many-locals
fixSocket() fixSocket()
@ -197,8 +199,12 @@ class Main(object):
# The closeEvent should command this thread to exit gracefully. # The closeEvent should command this thread to exit gracefully.
sqlLookup.daemon = False sqlLookup.daemon = False
sqlLookup.start() sqlLookup.start()
print("Thread Started........................................... 200 in bitmessagemain.py")
helper_sql.sql_ready.wait()
Inventory() # init Inventory() # init
print("thread after inventory 204..................................",helper_sql.sql_available)
# init, needs to be early because other thread may access it early # init, needs to be early because other thread may access it early
Dandelion() Dandelion()

View File

@ -35,7 +35,9 @@ class sqlThread(threading.Thread):
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`""" """Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
print("line no 38 in class_Sqlthread......................................",helper_sql.sql_available)
helper_sql.sql_available = True helper_sql.sql_available = True
print("run call in class_Sqlthread.py..................................",helper_sql.sql_available)
self.conn = sqlite3.connect(state.appdata + 'messages.dat') self.conn = sqlite3.connect(state.appdata + 'messages.dat')
self.conn.text_factory = str self.conn.text_factory = str
self.cur = self.conn.cursor() self.cur = self.conn.cursor()

View File

@ -28,7 +28,9 @@ sqlReturnQueue = queue.Queue()
sql_lock = threading.Lock() sql_lock = threading.Lock()
""" lock to prevent queueing a new request until the previous response """ lock to prevent queueing a new request until the previous response
is available """ is available """
print("31...............................................................................before sql_available")
sql_available = False sql_available = False
print("33................................................................................sql_available",sql_available)
"""set to True by `.threads.sqlThread` immediately upon start""" """set to True by `.threads.sqlThread` immediately upon start"""
sql_ready = threading.Event() sql_ready = threading.Event()
"""set by `.threads.sqlThread` when ready for processing (after """set by `.threads.sqlThread` when ready for processing (after
@ -43,7 +45,11 @@ def sqlQuery(sql_statement, *args):
:param list args: SQL query parameters :param list args: SQL query parameters
:rtype: list :rtype: list
""" """
print('before asser throw............................................................................',sql_available)
print("sql_statementsql_statementsql_statementsql_statement before",sql_statement)
assert sql_available assert sql_available
print('after asser throw............................................................................',sql_available)
print("sql_statementsql_statementsql_statementsql_statementsql_statementsql_statement after",sql_statement)
sql_lock.acquire() sql_lock.acquire()
sqlSubmitQueue.put(sql_statement) sqlSubmitQueue.put(sql_statement)

View File

@ -1,8 +1,8 @@
"""The Inventory singleton""" """The Inventory singleton"""
# TODO make this dynamic, and watch out for frozen, like with messagetypes # TODO make this dynamic, and watch out for frozen, like with messagetypes
import storage.filesystem import pybitmessage.storage.filesystem
import storage.sqlite import pybitmessage.storage.sqlite
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from singleton import Singleton from singleton import Singleton
@ -16,7 +16,7 @@ class Inventory():
def __init__(self): def __init__(self):
self._moduleName = BMConfigParser().safeGet("inventory", "storage") self._moduleName = BMConfigParser().safeGet("inventory", "storage")
self._inventoryClass = getattr( self._inventoryClass = getattr(
getattr(storage, self._moduleName), getattr(pybitmessage.storage, self._moduleName),
"{}Inventory".format(self._moduleName.title()) "{}Inventory".format(self._moduleName.title())
) )
self._realInventory = self._inventoryClass() self._realInventory = self._inventoryClass()

View File

@ -1,6 +1,7 @@
"""This module is for thread start.""" """This module is for thread start."""
import state import state
import sys import sys
import pdb;pdb.set_trace()
from bitmessagemain import main from bitmessagemain import main
from termcolor import colored from termcolor import colored
print(colored('kivy is not supported at the moment for this version..', 'red')) print(colored('kivy is not supported at the moment for this version..', 'red'))

View File

@ -1,7 +1,7 @@
""" """
Network subsystem packages Network subsystem packages
""" """
from addrthread import AddrThread from pybitmessage.network.addrthread import AddrThread
from announcethread import AnnounceThread from announcethread import AnnounceThread
from connectionpool import BMConnectionPool from connectionpool import BMConnectionPool
from dandelion import Dandelion from dandelion import Dandelion

View File

@ -8,8 +8,8 @@ from binascii import hexlify, unhexlify
from os import listdir, makedirs, path, remove, rmdir from os import listdir, makedirs, path, remove, rmdir
from threading import RLock from threading import RLock
from paths import lookupAppdataFolder from pybitmessage.paths import lookupAppdataFolder
from storage import InventoryItem, InventoryStorage from pybitmessage.storage.storage import InventoryItem, InventoryStorage
logger = logging.getLogger('default') logger = logging.getLogger('default')
@ -239,7 +239,7 @@ class FilesystemInventory(InventoryStorage):
def hashes_by_stream(self, stream): def hashes_by_stream(self, stream):
"""Return inventory vectors (hashes) for a stream""" """Return inventory vectors (hashes) for a stream"""
try: try:
return self._inventory[stream].keys() return self._inventory[stream].keys()
except KeyError: except KeyError:
return [] return []
@ -264,6 +264,7 @@ class FilesystemInventory(InventoryStorage):
for streamDict in self._inventory.values(): for streamDict in self._inventory.values():
for hashId, item in streamDict.items(): for hashId, item in streamDict.items():
if item.expires < minTime: if item.expires < minTime:
deletes.append(hashId) deletes.append(hashId)
for hashId in deletes: for hashId in deletes:
self.delHashId(hashId) self.delHashId(hashId)

View File

@ -5,8 +5,8 @@ import sqlite3
import time import time
from threading import RLock from threading import RLock
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery from pybitmessage.helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sql_ready
from storage import InventoryItem, InventoryStorage from pybitmessage.storage.storage import InventoryItem, InventoryStorage
class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
@ -90,6 +90,11 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
return values return values
def unexpired_hashes_by_stream(self, stream): def unexpired_hashes_by_stream(self, stream):
# sql_ready.wait()
from threading import current_thread
print(current_thread().name,"Thread running....................................................")
"""Return unexpired inventory vectors filtered by stream""" """Return unexpired inventory vectors filtered by stream"""
with self.lock: with self.lock:
t = int(time.time()) t = int(time.time())