Skip to content

WIP: create a split dealer socket#194

Closed
rgbkrk wants to merge 1 commit intomasterfrom
split-connection
Closed

WIP: create a split dealer socket#194
rgbkrk wants to merge 1 commit intomasterfrom
split-connection

Conversation

@rgbkrk
Copy link
Member

@rgbkrk rgbkrk commented Jul 12, 2024

There are cases when using the DealerSocket when we need to be able to both continuously send and receive messages without deadlocking either one. For example, with code like this:

socket.send(message).await?;
let reply = socket.recv().await?;

If we don't get a reply back for that message type we can no longer send out other messages. An approach seen in other code bases is to introduce a .split() method that breaks up reading and writing. This is a start to that.

An alternative would be to make a try_clone like TcpStream has which:

Creates a new independently owned handle to the underlying socket.

The returned TcpStream is a reference to the same stream that this object references. Both handles will read and write the same stream of data, and options set on one stream will be propagated to the other stream.

Co-Authored-By: Kirill <kirill@zed.dev>
@rgbkrk rgbkrk closed this Dec 13, 2024
@rgbkrk rgbkrk deleted the split-connection branch February 8, 2026 01:17
rgbkrk added a commit that referenced this pull request Feb 8, 2026
rgbkrk added a commit that referenced this pull request Feb 8, 2026
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.

1 participant