Link window optimisations

This commit is contained in:
Mark Qvist 2018-12-31 20:33:55 +01:00
parent 4d0ca28902
commit bcfcf4eb86
4 changed files with 16 additions and 8 deletions

View File

@ -8,7 +8,7 @@ Reticulum is a complete networking stack, and does not use IP or higher layers,
For more info, see [unsigned.io/projects/reticulum](http://unsigned.io/projects/reticulum/) For more info, see [unsigned.io/projects/reticulum](http://unsigned.io/projects/reticulum/)
## Current Status ## Current Status
Reticulum is currently in pre-alpha state. Even the master branch should be considered experimental. At this point the protocol may change without notice, and is made publicly available for development collaboration, previewing and testing features. Do not build anything serious with Reticulum yet. Stable alpha release will be at the end of June 2018. Reticulum is currently in pre-alpha state. Even the master branch should be considered experimental. At this point the protocol may change without notice, and is made publicly available for development collaboration, previewing and testing features. Do not build anything serious with Reticulum yet. Stable alpha release will be in early 2019.
## What hardware does Reticulum work with? ## What hardware does Reticulum work with?
Practically any hardware that can support at least a half-duplex channel with 1.000 bits per second throughput, and an MTU of 500 bytes. Data radios, modems, LoRa radios, serial lines, AX.25 TNCs, HAM radio digital modes, free-space optical systems and similar systems are all examples of the types of interfaces Reticulum was designed for. Practically any hardware that can support at least a half-duplex channel with 1.000 bits per second throughput, and an MTU of 500 bytes. Data radios, modems, LoRa radios, serial lines, AX.25 TNCs, HAM radio digital modes, free-space optical systems and similar systems are all examples of the types of interfaces Reticulum was designed for.
@ -18,7 +18,7 @@ An open-source LoRa-based interface called [RNode](https://unsigned.io/projects/
Reticulum can also be tunneled over existing IP networks. Reticulum can also be tunneled over existing IP networks.
## Can I use Reticulum for amateur radio? ## Can I use Reticulum for amateur radio?
Many countries ban the use of encryption when operating under an amateur radio license. Reticulum offers several encryptionless modes, while still using cryptographic principles for station verification, link establishment, data integrity verification, acknowledgements and routing. It is therefore perfectly possible to include Reticulum in amateur radio use, even if your country bans encryption. Some countries still ban the use of encryption when operating under an amateur radio license. Reticulum offers several encryptionless modes, while still using cryptographic principles for station verification, link establishment, data integrity verification, acknowledgements and routing. It is therefore perfectly possible to include Reticulum in amateur radio use, even if your country bans encryption.
## How do I get started? ## How do I get started?
Full documentation and video tutorials are coming with the stable alpha release. Until then, you are 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 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)

View File

@ -397,7 +397,7 @@ class RNodeInterface(Interface):
self.r_stat_tx = ord(command_buffer[0]) << 24 | ord(command_buffer[1]) << 16 | ord(command_buffer[2]) << 8 | ord(command_buffer[3]) self.r_stat_tx = ord(command_buffer[0]) << 24 | ord(command_buffer[1]) << 16 | ord(command_buffer[2]) << 8 | ord(command_buffer[3])
elif (command == KISS.CMD_STAT_RSSI): elif (command == KISS.CMD_STAT_RSSI):
self.r_stat_rssi = ord(byte)-RSSI_OFFSET self.r_stat_rssi = ord(byte)-RNodeInterface.RSSI_OFFSET
elif (command == KISS.CMD_RANDOM): elif (command == KISS.CMD_RANDOM):
self.r_random = ord(byte) self.r_random = ord(byte)
elif (command == KISS.CMD_ERROR): elif (command == KISS.CMD_ERROR):

View File

@ -64,10 +64,12 @@ class Link:
link.last_inbound = time.time() link.last_inbound = time.time()
link.start_watchdog() link.start_watchdog()
if link.owner.callbacks.link_established != None: # TODO: Why was link_established callback here? Seems weird
link.owner.callbacks.link_established(link) # to call this before RTT packet has been received
#if self.owner.callbacks.link_established != None:
# self.owner.callbacks.link_established(link)
RNS.log("Incoming link request "+str(link)+" accepted", RNS.LOG_VERBOSE) RNS.log("Incoming link request "+str(link)+" accepted, waiting for RTT packet", RNS.LOG_VERBOSE)
return link return link
except Exception as e: except Exception as e:
@ -191,6 +193,7 @@ class Link:
RNS.log("Link "+str(self)+" established with "+str(self.destination)+", RTT is "+str(self.rtt), RNS.LOG_VERBOSE) RNS.log("Link "+str(self)+" established with "+str(self.destination)+", RTT is "+str(self.rtt), RNS.LOG_VERBOSE)
rtt_data = umsgpack.packb(self.rtt) rtt_data = umsgpack.packb(self.rtt)
rtt_packet = RNS.Packet(self, rtt_data, context=RNS.Packet.LRRTT) rtt_packet = RNS.Packet(self, rtt_data, context=RNS.Packet.LRRTT)
RNS.log("Sending RTT packet", RNS.LOG_EXTREME);
rtt_packet.send() rtt_packet.send()
self.status = Link.ACTIVE self.status = Link.ACTIVE
@ -215,7 +218,12 @@ class Link:
rtt = umsgpack.unpackb(plaintext) rtt = umsgpack.unpackb(plaintext)
self.rtt = max(measured_rtt, rtt) self.rtt = max(measured_rtt, rtt)
self.status = Link.ACTIVE self.status = Link.ACTIVE
# TODO: Link established callback moved here, ok?
if self.owner.callbacks.link_established != None:
self.owner.callbacks.link_established(self)
except Exception as e: except Exception as e:
RNS.log("Error occurred while processing RTT packet, tearing down link", RNS.LOG_ERROR)
traceback.print_exc()
self.teardown() self.teardown()
def getSalt(self): def getSalt(self):

View File

@ -8,8 +8,8 @@ from time import sleep
class Resource: class Resource:
WINDOW_MIN = 1 WINDOW_MIN = 1
WINDOW_MAX = 10 WINDOW_MAX = 7
WINDOW = 5 WINDOW = 4
MAPHASH_LEN = 4 MAPHASH_LEN = 4
SDU = RNS.Reticulum.MTU - RNS.Packet.HEADER_MAXSIZE SDU = RNS.Reticulum.MTU - RNS.Packet.HEADER_MAXSIZE
RANDOM_HASH_SIZE = 4 RANDOM_HASH_SIZE = 4