Merge pull request #32 from jaicis/codefixes
Kivy database and safegetint issues
This commit is contained in:
commit
6145c4dd02
|
@ -647,8 +647,8 @@ class DropDownWidget(BoxLayout):
|
||||||
0,
|
0,
|
||||||
'sent',
|
'sent',
|
||||||
encoding,
|
encoding,
|
||||||
int(BMConfigParser().safeGet(
|
BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'ttl')))
|
'bitmessagesettings', 'ttl'))
|
||||||
state.check_sent_acc = fromAddress
|
state.check_sent_acc = fromAddress
|
||||||
# state.msg_counter_objs = self.parent.parent.parent.parent\
|
# state.msg_counter_objs = self.parent.parent.parent.parent\
|
||||||
# .parent.parent.children[2].children[0].ids
|
# .parent.parent.children[2].children[0].ids
|
||||||
|
@ -2331,7 +2331,7 @@ class Draft(Screen):
|
||||||
0,
|
0,
|
||||||
'draft',
|
'draft',
|
||||||
encoding,
|
encoding,
|
||||||
int(BMConfigParser().safeGet('bitmessagesettings', 'ttl')))
|
BMConfigParser().safeGetInt('bitmessagesettings', 'ttl'))
|
||||||
state.msg_counter_objs = src_object.children[2].children[0].ids
|
state.msg_counter_objs = src_object.children[2].children[0].ids
|
||||||
state.draft_count = str(int(state.draft_count) + 1)
|
state.draft_count = str(int(state.draft_count) + 1)
|
||||||
src_object.ids.sc16.clear_widgets()
|
src_object.ids.sc16.clear_widgets()
|
||||||
|
|
|
@ -116,9 +116,7 @@ class addressGenerator(StoppableThread):
|
||||||
payloadLengthExtraBytes = \
|
payloadLengthExtraBytes = \
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes
|
defaults.networkDefaultPayloadLengthExtraBytes
|
||||||
if command == 'createRandomAddress':
|
if command == 'createRandomAddress':
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put(('updateStatusBar', None))
|
||||||
'updateStatusBar'
|
|
||||||
))
|
|
||||||
# This next section is a little bit strange. We're going
|
# This next section is a little bit strange. We're going
|
||||||
# to generate keys over and over until we find one
|
# to generate keys over and over until we find one
|
||||||
# that starts with either \x00 or \x00\x00. Then when
|
# that starts with either \x00 or \x00\x00. Then when
|
||||||
|
@ -192,10 +190,7 @@ class addressGenerator(StoppableThread):
|
||||||
# The API and the join and create Chan functionality
|
# The API and the join and create Chan functionality
|
||||||
# both need information back from the address generator.
|
# both need information back from the address generator.
|
||||||
queues.apiAddressGeneratorReturnQueue.put(address)
|
queues.apiAddressGeneratorReturnQueue.put(address)
|
||||||
|
queues.UISignalQueue.put(('updateStatusBar', None))
|
||||||
queues.UISignalQueue.put((
|
|
||||||
'updateStatusBar'
|
|
||||||
))
|
|
||||||
queues.UISignalQueue.put(('writeNewAddressToTable', (
|
queues.UISignalQueue.put(('writeNewAddressToTable', (
|
||||||
label, address, streamNumber)))
|
label, address, streamNumber)))
|
||||||
shared.reloadMyAddressHashes()
|
shared.reloadMyAddressHashes()
|
||||||
|
|
|
@ -49,9 +49,14 @@ def json_serialize_knownnodes(output):
|
||||||
for stream, peers in iter(knownNodes.items()):
|
for stream, peers in iter(knownNodes.items()):
|
||||||
for peer, info in iter(peers.items()):
|
for peer, info in iter(peers.items()):
|
||||||
info.update(rating=round(info.get('rating', 0), 2))
|
info.update(rating=round(info.get('rating', 0), 2))
|
||||||
|
if type(peer[0]) != bytes:
|
||||||
|
_serialized.append({'stream': stream, 'peer': peer._asdict(), 'info': info})
|
||||||
|
else:
|
||||||
|
from collections import OrderedDict
|
||||||
_serialized.append({
|
_serialized.append({
|
||||||
'stream': stream, 'peer': peer._asdict(), 'info': info
|
'stream': stream,
|
||||||
})
|
'peer': OrderedDict({'host': str(peer[0].decode()), 'port': int(peer[1])}),
|
||||||
|
'info': info})
|
||||||
json.dump(_serialized, output, indent=4)
|
json.dump(_serialized, output, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +176,7 @@ def decreaseRating(peer):
|
||||||
def trimKnownNodes(recAddrStream=1):
|
def trimKnownNodes(recAddrStream=1):
|
||||||
"""Triming Knownnodes"""
|
"""Triming Knownnodes"""
|
||||||
if len(knownNodes[recAddrStream]) < \
|
if len(knownNodes[recAddrStream]) < \
|
||||||
int(BMConfigParser().safeGet("knownnodes", "maxnodes")):
|
BMConfigParser().safeGetInt("knownnodes", "maxnodes"):
|
||||||
return
|
return
|
||||||
with knownNodesLock:
|
with knownNodesLock:
|
||||||
oldestList = sorted(
|
oldestList = sorted(
|
||||||
|
|
|
@ -480,7 +480,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
||||||
continue
|
continue
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if len(knownnodes.knownNodes[stream]) < int(BMConfigParser().safeGet("knownnodes", "maxnodes")):
|
if len(knownnodes.knownNodes[stream]) < BMConfigParser().safeGetInt("knownnodes", "maxnodes"):
|
||||||
with knownnodes.knownNodesLock:
|
with knownnodes.knownNodesLock:
|
||||||
try:
|
try:
|
||||||
knownnodes.knownNodes[stream][peer]["lastseen"] = \
|
knownnodes.knownNodes[stream][peer]["lastseen"] = \
|
||||||
|
|
|
@ -192,7 +192,7 @@ class BMConnectionPool(object):
|
||||||
if bind is None:
|
if bind is None:
|
||||||
"this return blank host"
|
"this return blank host"
|
||||||
bind = self.getListeningIP()
|
bind = self.getListeningIP()
|
||||||
port = int(BMConfigParser().safeGet("bitmessagesettings", "port"))
|
port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
|
||||||
# correct port even if it changed
|
# correct port even if it changed
|
||||||
ls = TCPServer(host=bind, port=port)
|
ls = TCPServer(host=bind, port=port)
|
||||||
self.listeningSockets[ls.destination] = ls
|
self.listeningSockets[ls.destination] = ls
|
||||||
|
@ -274,8 +274,8 @@ class BMConnectionPool(object):
|
||||||
Proxy.proxy = (
|
Proxy.proxy = (
|
||||||
BMConfigParser().safeGet(
|
BMConfigParser().safeGet(
|
||||||
'bitmessagesettings', 'sockshostname'),
|
'bitmessagesettings', 'sockshostname'),
|
||||||
int(BMConfigParser().safeGet(
|
BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'socksport'))
|
'bitmessagesettings', 'socksport')
|
||||||
)
|
)
|
||||||
# TODO AUTH
|
# TODO AUTH
|
||||||
# TODO reset based on GUI settings changes
|
# TODO reset based on GUI settings changes
|
||||||
|
@ -294,8 +294,8 @@ class BMConnectionPool(object):
|
||||||
1 for c in [outboundConnections for outboundConnections in self.outboundConnections.values()]
|
1 for c in [outboundConnections for outboundConnections in self.outboundConnections.values()]
|
||||||
if (c.connected and c.fullyEstablished))
|
if (c.connected and c.fullyEstablished))
|
||||||
pending = len(self.outboundConnections) - established
|
pending = len(self.outboundConnections) - established
|
||||||
if established < int(BMConfigParser().safeGet(
|
if established < BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'maxoutboundconnections')):
|
'bitmessagesettings', 'maxoutboundconnections'):
|
||||||
for i in range(
|
for i in range(
|
||||||
state.maximumNumberOfHalfOpenConnections - pending):
|
state.maximumNumberOfHalfOpenConnections - pending):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -241,7 +241,7 @@ def checkSensitiveFilePermissions(filename):
|
||||||
shell=True,
|
shell=True,
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
if 'fuseblk' in fstype:
|
if 'fuseblk'.encode() in fstype:
|
||||||
logger.info(
|
logger.info(
|
||||||
'Skipping file permissions check for %s.'
|
'Skipping file permissions check for %s.'
|
||||||
' Filesystem fuseblk detected.', filename)
|
' Filesystem fuseblk detected.', filename)
|
||||||
|
|
Reference in New Issue
Block a user