Skip to content
Snippets Groups Projects
Commit 31c5b624 authored by inso's avatar inso
Browse files

Correction du bug de raffrichissement de la liste des noeuds

parent f16ffb40
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
fx="52.325901" fx="52.325901"
fy="1005.1627" fy="1005.1627"
r="42.926411" r="42.926411"
gradientTransform="matrix(1.539681,0,0,1.5451884,-48.391841,-562.49866)" gradientTransform="matrix(1.539681,0,0,1.5451884,-68.190831,-562.49866)"
gradientUnits="userSpaceOnUse" /> gradientUnits="userSpaceOnUse" />
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.8284271" inkscape:zoom="2.8284271"
inkscape:cx="80.436882" inkscape:cx="18.741815"
inkscape:cy="33.829638" inkscape:cy="33.829638"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
units="px" units="px"
inkscape:snap-bbox="false" inkscape:snap-bbox="false"
inkscape:window-width="1366" inkscape:window-width="1366"
inkscape:window-height="725" inkscape:window-height="709"
inkscape:window-x="-7" inkscape:window-x="-4"
inkscape:window-y="17" inkscape:window-y="0"
inkscape:window-maximized="1" /> inkscape:window-maximized="1" />
<metadata <metadata
id="metadata3341"> id="metadata3341">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
id="layer1" id="layer1"
transform="translate(0,-952.36216)"> transform="translate(0,-952.36216)">
<ellipse <ellipse
style="opacity:1;fill:#17d017;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:1;fill:#17d017;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3346" id="path3346"
cx="51.785713" cx="51.785713"
cy="1005.5765" cy="1005.5765"
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<ellipse <ellipse
style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4148" id="path4148"
cx="32.173359" cx="12.374369"
cy="990.66699" cy="990.66699"
rx="64.928177" rx="64.928177"
ry="65.10495" /> ry="65.10495" />
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
fx="52.325901" fx="52.325901"
fy="1005.1627" fy="1005.1627"
r="42.926411" r="42.926411"
gradientTransform="matrix(1.539681,0,0,1.5451884,-48.038287,-560.37733)" gradientTransform="matrix(1.539681,0,0,1.5451884,-50.51316,-559.67022)"
gradientUnits="userSpaceOnUse" /> gradientUnits="userSpaceOnUse" />
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.8284271" inkscape:zoom="2.8284271"
inkscape:cx="80.436882" inkscape:cx="18.741815"
inkscape:cy="33.829638" inkscape:cy="33.829638"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
units="px" units="px"
inkscape:snap-bbox="false" inkscape:snap-bbox="false"
inkscape:window-width="1366" inkscape:window-width="1366"
inkscape:window-height="725" inkscape:window-height="709"
inkscape:window-x="-7" inkscape:window-x="-4"
inkscape:window-y="17" inkscape:window-y="0"
inkscape:window-maximized="1" /> inkscape:window-maximized="1" />
<metadata <metadata
id="metadata3341"> id="metadata3341">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
id="layer1" id="layer1"
transform="translate(0,-952.36216)"> transform="translate(0,-952.36216)">
<ellipse <ellipse
style="opacity:1;fill:#c60002;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:1;fill:#c60002;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3346" id="path3346"
cx="51.785713" cx="51.785713"
cy="1005.5765" cy="1005.5765"
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
<ellipse <ellipse
style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4148" id="path4148"
cx="32.526913" cx="30.05204"
cy="992.78827" cy="993.49536"
rx="64.928177" rx="64.928177"
ry="65.10495" /> ry="65.10495" />
</g> </g>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
fx="52.325901" fx="52.325901"
fy="1005.1627" fy="1005.1627"
r="42.926411" r="42.926411"
gradientTransform="matrix(1.539681,0,0,1.5451884,-51.220268,-564.97353)" gradientTransform="matrix(1.539681,0,0,1.5451884,-51.927374,-565.68063)"
gradientUnits="userSpaceOnUse" /> gradientUnits="userSpaceOnUse" />
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.8284271" inkscape:zoom="2.8284271"
inkscape:cx="80.436882" inkscape:cx="18.741815"
inkscape:cy="33.829638" inkscape:cy="33.829638"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
units="px" units="px"
inkscape:snap-bbox="false" inkscape:snap-bbox="false"
inkscape:window-width="1366" inkscape:window-width="1366"
inkscape:window-height="725" inkscape:window-height="709"
inkscape:window-x="-7" inkscape:window-x="-4"
inkscape:window-y="17" inkscape:window-y="0"
inkscape:window-maximized="1" /> inkscape:window-maximized="1" />
<metadata <metadata
id="metadata3341"> id="metadata3341">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
id="layer1" id="layer1"
transform="translate(0,-952.36216)"> transform="translate(0,-952.36216)">
<ellipse <ellipse
style="opacity:1;fill:#fff41c;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:1;fill:#fff41c;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path3346" id="path3346"
cx="51.785713" cx="51.785713"
cy="1005.5765" cy="1005.5765"
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
<ellipse <ellipse
style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path4148" id="path4148"
cx="29.344933" cx="28.637825"
cy="988.19208" cy="987.48499"
rx="64.928177" rx="64.928177"
ry="65.10495" /> ry="65.10495" />
</g> </g>
......
...@@ -201,17 +201,16 @@ class Network(Watcher): ...@@ -201,17 +201,16 @@ class Network(Watcher):
''' '''
self._must_crawl = True self._must_crawl = True
while self.continue_crawling(): while self.continue_crawling():
emit_change = False
nodes = self.crawling(interval=10) nodes = self.crawling(interval=10)
new_inlines = [n.endpoint.inline() for n in nodes] new_inlines = [n.endpoint.inline() for n in nodes]
last_inlines = [n.endpoint.inline() for n in self.nodes] last_inlines = [n.endpoint.inline() for n in self.nodes]
hash_new_nodes = hash(tuple(frozenset(sorted(new_inlines)))) hash_new_nodes = str(tuple(frozenset(sorted(new_inlines))))
hash_last_nodes = hash(tuple(frozenset(sorted(last_inlines)))) hash_last_nodes = str(tuple(frozenset(sorted(last_inlines))))
emit_change = False
self._mutex.lock()
try:
if hash_new_nodes != hash_last_nodes: if hash_new_nodes != hash_last_nodes:
logging.debug("Nodes changed...")
self.nodes = nodes self.nodes = nodes
emit_change = True emit_change = True
...@@ -224,13 +223,10 @@ class Network(Watcher): ...@@ -224,13 +223,10 @@ class Network(Watcher):
logging.debug("Error : {0} not connected".format(node.pubkey)) logging.debug("Error : {0} not connected".format(node.pubkey))
self.nodes.remove(node) self.nodes.remove(node)
emit_change = True emit_change = True
except:
raise
finally:
self._mutex.unlock()
if emit_change: if emit_change:
self.nodes_changed.emit() self.nodes_changed.emit()
QCoreApplication.processEvents()
self.stopped_perpetual_crawling.emit() self.stopped_perpetual_crawling.emit()
......
...@@ -275,6 +275,7 @@ class Node(QObject): ...@@ -275,6 +275,7 @@ class Node(QObject):
except: except:
logging.error('Error calling libc.__res_init') logging.error('Error calling libc.__res_init')
except RequestException as e: except RequestException as e:
logging.debug(str(e))
if self.state != Node.OFFLINE: if self.state != Node.OFFLINE:
self.state = Node.OFFLINE self.state = Node.OFFLINE
logging.debug("Change : new state offine") logging.debug("Change : new state offine")
...@@ -347,7 +348,7 @@ class Node(QObject): ...@@ -347,7 +348,7 @@ class Node(QObject):
logging.debug(traversed_pubkeys) logging.debug(traversed_pubkeys)
logging.debug("Traversing : next to read : {0} : {1}".format(node.pubkey, logging.debug("Traversing : next to read : {0} : {1}".format(node.pubkey,
(node.pubkey not in traversed_pubkeys))) (node.pubkey not in traversed_pubkeys)))
node.peering_traversal(found_nodes, node.peering_traversal(knew_pubkeys, found_nodes,
traversed_pubkeys, interval, continue_crawling) traversed_pubkeys, interval, continue_crawling)
time.sleep(interval) time.sleep(interval)
except RequestException as e: except RequestException as e:
......
...@@ -77,3 +77,8 @@ class Monitor(object): ...@@ -77,3 +77,8 @@ class Monitor(object):
self.threads_pool.remove(watcher.thread()) self.threads_pool.remove(watcher.thread())
watcher.deleteLater() watcher.deleteLater()
watcher.thread().deleteLater() watcher.thread().deleteLater()
self.threads_pool = []
self._blockchain_watchers = {}
self._network_watchers = {}
self._persons_watchers = {}
...@@ -156,13 +156,13 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): ...@@ -156,13 +156,13 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
logging.debug("Refresh status") logging.debug("Refresh status")
if self.community.network_quality() > 0.66: if self.community.network_quality() > 0.66:
icon = '<img src=":/icons/connected" width="12" height="12"/>' icon = '<img src=":/icons/connected" width="12" height="12"/>'
text = "Connected : Block {0}".format(self.community.network.latest_block) text = " Block {0}".format(self.community.network.latest_block)
elif self.community.network_quality() > 0.33: elif self.community.network_quality() > 0.33:
icon = '<img src=":/icons/weak_connect" width="12" height="12"/>' icon = '<img src=":/icons/weak_connect" width="12" height="12"/>'
text = "Connected (weak link) : Block {0}".format(self.community.network.latest_block) text = " Block {0}".format(self.community.network.latest_block)
else: else:
icon = '<img src=":/icons/disconnected" width="12" height="12"/>' icon = '<img src=":/icons/disconnected" width="12" height="12"/>'
text = "Disconnected : Block {0}".format(self.community.network.latest_block) text = " Block {0}".format(self.community.network.latest_block)
self.status_label.setText("{0}{1}".format(icon, text)) self.status_label.setText("{0}{1}".format(icon, text))
def refresh_wallets(self): def refresh_wallets(self):
......
...@@ -6,7 +6,7 @@ Created on 20 févr. 2015 ...@@ -6,7 +6,7 @@ Created on 20 févr. 2015
import logging import logging
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import Qt, QThread from PyQt5.QtCore import Qt, QThread, pyqtSlot
from ..models.network import NetworkTableModel, NetworkFilterProxyModel from ..models.network import NetworkTableModel, NetworkFilterProxyModel
from ..gen_resources.network_tab_uic import Ui_NetworkTabWidget from ..gen_resources.network_tab_uic import Ui_NetworkTabWidget
...@@ -30,6 +30,7 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget): ...@@ -30,6 +30,7 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget):
community.network.nodes_changed.connect(self.refresh_nodes) community.network.nodes_changed.connect(self.refresh_nodes)
@pyqtSlot()
def refresh_nodes(self): def refresh_nodes(self):
logging.debug("Refresh nodes") logging.debug("Refresh nodes")
self.table_network.model().sourceModel().modelReset.emit() self.table_network.model().sourceModel().modelReset.emit()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment