Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

TCPRelayAffix relays data only after close on one side #56

@aaaaalbert

Description

@aaaaalbert

TCPRelayAffix's forwarding function is responsible for relaying data between a server (host registered for "listening" via this relay) and a client (node connecting to said server). It has a bug that makes it buffer data until it detects that the socket connecting it and either the server or the client is closed. Only then it actually relays the received data to the other party.

This renders the relay barely usable for connections that employ timeouts (as buffering might consume much of that), and totally useless for connections exchanging more than one message at once.

A fix should ensure that the minimum sane amount of data is buffered on each read (e.g. one Ethernet frame's worth), and that it is sent out ASAP to the other side.

Keep in mind corner cases such as one side sending data then immediately closing the connection. From its TCP stack's perspective, the data has been delivered to the remote stack. In fact, that remote stack is only the relay, not the actual destination host of the data. The relay should then not read more of the data the destination sent, still deliver the remaining source data, and close the connection as soon as all the source data is delivered.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions