diff --git a/plugins/P2P-messages/FileRequestPlugin.py b/plugins/P2P-messages/FileRequestPlugin.py index 99a7ef2e0..7ce53f914 100644 --- a/plugins/P2P-messages/FileRequestPlugin.py +++ b/plugins/P2P-messages/FileRequestPlugin.py @@ -127,6 +127,17 @@ def handlePeerSend(self, params): if not result: self.connection.badAction(10) + # Save to cache + if not websockets and raw["immediate"]: + site.p2p_unread.append({ + "ip": ip, + "hash": msg_hash, + "message": raw["message"], + "signed_by": signature_address, + "cert": cert, + "broadcast": False + }) + def peerCheckMessage(self, raw, params, ip): # Calculate hash from nonce diff --git a/plugins/P2P-messages/UiWebsocketPlugin.py b/plugins/P2P-messages/UiWebsocketPlugin.py index e1c1e52e4..54b04240b 100644 --- a/plugins/P2P-messages/UiWebsocketPlugin.py +++ b/plugins/P2P-messages/UiWebsocketPlugin.py @@ -116,7 +116,7 @@ def p2pBroadcast(self, peer, data): # Send a message to IP def actionPeerSend(self, *args, **kwargs): gevent.spawn(self.handlePeerSend, *args, **kwargs) - def handlePeerSend(self, to_, ip, message, privatekey=None, to=None): + def handlePeerSend(self, to_, ip, message, privatekey=None, to=None, immediate=False): # Check message if not self.peerCheckMessage(to_, message): return @@ -137,6 +137,7 @@ def handlePeerSend(self, to_, ip, message, privatekey=None, to=None): # Generate hash all_message = { "message": message, + "immediate": immediate, "site": self.site.address } if to: