Added multi-interface duplicate deque to AutoInterface
This commit is contained in:
parent
3a947bf81b
commit
a06e752b76
@ -21,6 +21,7 @@
|
|||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
from .Interface import Interface
|
from .Interface import Interface
|
||||||
|
from collections import deque
|
||||||
import socketserver
|
import socketserver
|
||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
@ -50,6 +51,8 @@ class AutoInterface(Interface):
|
|||||||
|
|
||||||
BITRATE_GUESS = 10*1000*1000
|
BITRATE_GUESS = 10*1000*1000
|
||||||
|
|
||||||
|
MULTI_IF_DEQUE_LEN = 64
|
||||||
|
|
||||||
def handler_factory(self, callback):
|
def handler_factory(self, callback):
|
||||||
def create_handler(*args, **keys):
|
def create_handler(*args, **keys):
|
||||||
return AutoInterfaceHandler(callback, *args, **keys)
|
return AutoInterfaceHandler(callback, *args, **keys)
|
||||||
@ -89,6 +92,7 @@ class AutoInterface(Interface):
|
|||||||
self.interface_servers = {}
|
self.interface_servers = {}
|
||||||
self.multicast_echoes = {}
|
self.multicast_echoes = {}
|
||||||
self.timed_out_interfaces = {}
|
self.timed_out_interfaces = {}
|
||||||
|
self.mif_deque = deque(maxlen=AutoInterface.MULTI_IF_DEQUE_LEN)
|
||||||
self.carrier_changed = False
|
self.carrier_changed = False
|
||||||
|
|
||||||
self.outbound_udp_socket = None
|
self.outbound_udp_socket = None
|
||||||
@ -391,8 +395,11 @@ class AutoInterface(Interface):
|
|||||||
self.peers[addr][1] = time.time()
|
self.peers[addr][1] = time.time()
|
||||||
|
|
||||||
def processIncoming(self, data):
|
def processIncoming(self, data):
|
||||||
self.rxb += len(data)
|
data_hash = RNS.Identity.full_hash(data)
|
||||||
self.owner.inbound(data, self)
|
if not data_hash in self.mif_deque:
|
||||||
|
self.mif_deque.append(data_hash)
|
||||||
|
self.rxb += len(data)
|
||||||
|
self.owner.inbound(data, self)
|
||||||
|
|
||||||
def processOutgoing(self,data):
|
def processOutgoing(self,data):
|
||||||
for peer in self.peers:
|
for peer in self.peers:
|
||||||
|
Loading…
Reference in New Issue
Block a user