Skip to content

Conversation

@thedevbirb
Copy link
Contributor

@thedevbirb thedevbirb commented Dec 10, 2025

When a client is done sending data, it sends a FIN message to the server. This is interpreted by the Framed abstraction as an EOF, which means that when we poll it returns Poll::Ready(None).

The current logic decides to close to connection on such event, but this is incorrect. The peer is still available to receive a response to the last data that has been sent. This has been now changed so that we try to send and flush all messages in the egress queue.

However, pending messages which haven't been handled yet by the consumer of this library are still dropped. We can refine it later.

This PR also closes #139, by adding a special handling of the string PING. This means an external service that wants to ping an application running a msg-rs TCP server must send the following bytes:

\x02\x00\x00\x00\x00\x00\x00\x00\x00\x04PING

So that they're correctly interpreted according to Codec implementation. The response would be just the bytes of PONG, with encoding:

\x02\x00\x00\x00\x00\x00\x00\x00\x00\x04PONG

When a client is done sending data, it sends a FIN message to the
server. This is interpreted by the `Framed` abstraction as an EOF, which
means that when we poll it returns `Poll::Ready(None)`.

The current logic decides to close to connection on such event, but this
is incorrect. The peer is still available to receive a response to the
last data that has been sent. This has been now changed so that we try
to send and flush all messages in the egress queue.

However, pending messages which haven't been handled yet by the consumer
of this library are still dropped. We can refine it later
Copy link
Contributor

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with one pedantic nit

Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Small nits

@thedevbirb thedevbirb merged commit 7f351aa into main Dec 11, 2025
10 checks passed
@thedevbirb thedevbirb deleted the lore/fix/last-flush branch December 11, 2025 10:50
thedevbirb added a commit to BuilderNet/FlowProxy that referenced this pull request Dec 15, 2025
This release drops the HTTP server used in FlowProxy for dealing with
system
requests. Now only the TCP server exists. It marks a breaking change in
FlowProxy, because backwards compatibility is not maintained anymore.

- The HTTP server on the usual system api port (5544) has been dropped,
meaning
that also the `readyz`/`infoz`/`livez` endpoint are now unsupported as
well.
Healthchecks will be performed by sending a special packet to the TCP
server,
  see <chainbound/msg-rs#140>.
- As mentioned above, all functionality related to `infoz` endpoint for
port
discovery has been dropped, and the socket address returned from
BuilderHub is
  assumed to be for the TCP server.
- The flag `--system-listen-addr-tcp` (`SYSTEM_LISTEN_ADDR_TCP`) has
been
  dropped.
- The flag `--system-listen-addr-http` (`SYSTEM_LISTEN_ADDR`) has been
renamed
to `--system-listen-addr`, with same environment variable name, and it
now is
  used to bind the TCP server.
- The flag `--http.client-pool-size` (`CLIENT_POOL_SIZE`) has been
removed since
  there are no more HTTP clients used for forwarding orders to peers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Basic ping-pong support in req/rep

4 participants