Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gfodor
Copy link

@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
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
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