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,6 +395,9 @@ class AutoInterface(Interface):
|
|||||||
self.peers[addr][1] = time.time()
|
self.peers[addr][1] = time.time()
|
||||||
|
|
||||||
def processIncoming(self, data):
|
def processIncoming(self, data):
|
||||||
|
data_hash = RNS.Identity.full_hash(data)
|
||||||
|
if not data_hash in self.mif_deque:
|
||||||
|
self.mif_deque.append(data_hash)
|
||||||
self.rxb += len(data)
|
self.rxb += len(data)
|
||||||
self.owner.inbound(data, self)
|
self.owner.inbound(data, self)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user