tatsuhiro-t / spdylay

The experimental SPDY protocol version 2, 3 and 3.1 implementation in C
http://tatsuhiro-t.github.io/spdylay/
MIT License
603 stars 102 forks source link

Control/Data Flags not passed to send_callback in spdylay_session_send #57

Closed JamieMeyers closed 11 years ago

JamieMeyers commented 11 years ago

https://github.com/tatsuhiro-t/spdylay/blob/master/lib/spdylay_session.c#L1528

In spdylay_session_send, send_callback always is passed flags set to 0, instead of the correct flags for the data or control frame.

Here is a quick patch:

int flags = (session->aob.item->frame_cat == SPDYLAY_CTRL) ? spdylay_outbound_item_get_ctrl_frame(session->aob.item)->ctrl.hd.flags : spdylay_outbound_item_get_data_frame(session->aob.item)->flags; sentlen = session->callbacks.send_callback(session, data, datalen, flags, session->user_data);

tatsuhiro-t commented 11 years ago

The flags in send_callback and read_callback is a little bit different from flags in SPDY frame. It is intended to work like flags in read(2) or write(2) system call and convey some performance optimization hits. At the moment, that facility is not implemented and they are always 0. The source of the confusion is that they are not properly documented. I'll document this in read_callback and write_callback documentation.

tatsuhiro-t commented 11 years ago

FYI, if you want to know the outgoing flags in SPDY frame, use on_ctrl_send_callback and on_data_send_callback.

JamieMeyers commented 11 years ago

Thanks for explaining the documentation issue.

tatsuhiro-t commented 11 years ago

Documented this. Closing.