Skip to content

Add recv stream id so stream can be tracked during callbacks#4

Open
gfodor wants to merge 1 commit into
bugnano:masterfrom
gfodor:add_recv_stream_id
Open

Add recv stream id so stream can be tracked during callbacks#4
gfodor wants to merge 1 commit into
bugnano:masterfrom
gfodor:add_recv_stream_id

Conversation

@gfodor
Copy link
Copy Markdown

@gfodor gfodor commented Jan 30, 2024

Right now there doesn't seem to be a way to identify where incoming bytes came from in terms of the original stream. (You can only see the connection, and the stream struct lacks identifying information.) This adds the recv_stream id to the struct.

@gfodor
Copy link
Copy Markdown
Author

gfodor commented Jan 30, 2024

Actually this PR can probably be closed - I did not understand there was one GenServer per stream. That said, the integer id for the stream does seem to be useful information in general so maybe worth merging.

@bugnano
Copy link
Copy Markdown
Owner

bugnano commented Jan 31, 2024

My intended way for using the stream was that if you need an id, that id can be self() in the handle_stream callback, and you do something like:

def handle_stream(%Stream{} = _stream, state) do
  state = Map.put(state, :recv_stream_id, self())
  {:continue, state}
end

without the need of patching this library.

Consider that state is a variable that is available to the user to do anything he wants.

Sounds good?

@bugnano bugnano force-pushed the master branch 5 times, most recently from 457f53a to 04123c1 Compare October 1, 2024 11:33
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.

2 participants