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

a problem to implement the callback on_ctrl_not_send_callback #134

Closed
sambc-SDK opened this issue Jun 24, 2015 · 3 comments
Closed

a problem to implement the callback on_ctrl_not_send_callback #134

sambc-SDK opened this issue Jun 24, 2015 · 3 comments

Comments

@sambc-SDK
Copy link

Hi, I used spdylay to build some programs well before.But today I found a problem when I implementing the callback on_ctrl_not_send_callback.

Background:
In my client program, every stream is associated with a structure -- "request" -- which I implement by myself. The program will new a request structure when it want to send a request, and call the function spdylay_submit_request with the request structure as the argument stream_user_data. So I can free the request structure in callback on_stream_close_callback when the stream is closing.

Problem:
Today, I found a problem when I implementing the callback on_ctrl_not_send_callback.
When on_ctrl_not_send_callback is called, and the argument type is SPDYLAY_SYN_STREAM, it means a STREAM is being canceled. Then I try to free the request structure of this stream, and I found I can't do it, because the frame->syn_stream->stream_id is zero and I can't find the structure from the stream by calling spdylay_session_get_stream_user_data().

This is the problem what I found. And thanks for reply.

@tatsuhiro-t
Copy link
Owner

This is indeed an issue. The thing is we only create stream after we decided to send SYN_STREAM, so in this case, stream is not created, and no stream ID is assigned.
We fixed this in nghttp2 API, but not ported to spdylay, since it would break API compatibility.
I think I can fix this problem, by allocating stream ID when spdylay_submit_request or spdylay_submit_syn_stream are called. And create stream as needed when calling on_ctrl_not_send_callback.

@tatsuhiro-t
Copy link
Owner

I just pushed commit to fix this issue.

@sambc-SDK
Copy link
Author

Thank you very much, and it works well now.

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

No branches or pull requests

2 participants