mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
TCP performance improvements
This commit is contained in:
parent
d121562b22
commit
bf49eb2475
@ -55,7 +55,7 @@ Some countries still ban the use of encryption when operating under an amateur r
|
||||
- pyserial
|
||||
|
||||
## How do I get started?
|
||||
Full documentation and video tutorials are coming with the stable alpha release. Until then, you are mostly on your own. If you really want to experiment already, you could take a look in the "Examples" folder, for some well-documented example programs. Be sure to also read the [Reticulum Overview Document](http://unsigned.io/wp-content/uploads/2018/04/Reticulum_Overview_v0.4.pdf).
|
||||
Full documentation and video tutorials are coming with the stable alpha release. Until then, you are mostly on your own. If you really want to experiment already, you could take a look in the "Examples" folder, for some well-documented example programs. The default configuration file created by Reticulum on the first run is also worth reading. Be sure to also read the [Reticulum Overview Document](http://unsigned.io/wp-content/uploads/2018/04/Reticulum_Overview_v0.4.pdf).
|
||||
|
||||
If you just need Reticulum as a dependency for another application, the easiest way is probably via pip:
|
||||
|
||||
|
@ -78,10 +78,13 @@ class TCPClientInterface(Interface):
|
||||
data_buffer = b""
|
||||
|
||||
while True:
|
||||
data_in = self.socket.recv(1)
|
||||
data_in = self.socket.recv(1024)
|
||||
|
||||
if len(data_in) > 0:
|
||||
byte = ord(data_in)
|
||||
pointer = 0
|
||||
while pointer < len(data_in):
|
||||
byte = data_in[pointer]
|
||||
pointer += 1
|
||||
if (in_frame and byte == HDLC.FLAG):
|
||||
in_frame = False
|
||||
self.processIncoming(data_buffer)
|
||||
@ -108,9 +111,8 @@ class TCPClientInterface(Interface):
|
||||
except Exception as e:
|
||||
self.online = False
|
||||
RNS.log("An interface error occurred, the contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
RNS.log("The interface "+str(self.name)+" is now offline. Restart Reticulum to attempt reconnection.", RNS.LOG_ERROR)
|
||||
raise e
|
||||
|
||||
RNS.log("Tearing down "+str(self), RNS.LOG_ERROR)
|
||||
self.teardown()
|
||||
|
||||
def teardown(self):
|
||||
self.online = False
|
||||
@ -128,8 +130,6 @@ class TCPServerInterface(Interface):
|
||||
def __init__(self, owner, name, bindip=None, bindport=None):
|
||||
self.IN = True
|
||||
self.OUT = False
|
||||
self.transmit_delay = 0.001
|
||||
|
||||
self.name = name
|
||||
|
||||
if (bindip != None and bindport != None):
|
||||
|
@ -438,6 +438,7 @@ class Resource:
|
||||
pi = 0
|
||||
for part in self.parts:
|
||||
if part.map_hash == requested_hash:
|
||||
try:
|
||||
if not part.sent:
|
||||
part.send()
|
||||
self.sent_parts += 1
|
||||
@ -446,6 +447,10 @@ class Resource:
|
||||
self.last_activity = time.time()
|
||||
self.last_part_sent = self.last_activity
|
||||
break
|
||||
except Exception as e:
|
||||
RNS.log("Resource could not send parts, cancelling transfer!", RNS.LOG_ERROR)
|
||||
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
self.cancel()
|
||||
pi += 1
|
||||
|
||||
if wants_more_hashmap:
|
||||
@ -488,8 +493,11 @@ class Resource:
|
||||
self.status = Resource.FAILED
|
||||
if self.initiator:
|
||||
if self.link.status == RNS.Link.ACTIVE:
|
||||
try:
|
||||
cancel_packet = RNS.Packet(self.link, self.hash, context=RNS.Packet.RESOURCE_ICL)
|
||||
cancel_packet.send()
|
||||
except Exception as e:
|
||||
RNS.log("Could not send resource cancel packet, the contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
self.link.cancel_outgoing_resource(self)
|
||||
else:
|
||||
self.link.cancel_incoming_resource(self)
|
||||
|
Loading…
Reference in New Issue
Block a user