golemfactory / ya-relay

GNU General Public License v3.0
3 stars 6 forks source link

slotId in packet may cause issues in reliable relayed connection #312

Open staszek-krotki opened 1 year ago

staszek-krotki commented 1 year ago

When Node1 initiates a reliable, relayed connection with Node2 it remembers its slot on the server. When Node2 disconnects from the server then server marks its session as Purgatory in that slot and once the same Node2 initializes a new session it will be put into a new slot. If, after Node2 established a new session, Node1 would want to send something to Node2 it will try to use the previous slot number. Server will send back a disconnected message but smoltcp will try to re-transmit the same packet as is (meaning with the old slot Id in the header). And it will do so infinitely.

staszek-krotki commented 1 year ago

Server checks if the slot is in Purgatory state and if it is then tries to find if any other session has been established with the same nodeId - if yes then sends the packet to that slot instead.