Added stream_id argument to spdylay_data_source_read_callback
This commit is contained in:
parent
301eb29cd4
commit
54e4c80b96
|
@ -367,7 +367,8 @@ ssize_t hd_recv_callback(spdylay_session *session,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ssize_t file_read_callback
|
ssize_t file_read_callback
|
||||||
(spdylay_session *session, uint8_t *buf, size_t length, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t length, int *eof,
|
||||||
spdylay_data_source *source, void *user_data)
|
spdylay_data_source *source, void *user_data)
|
||||||
{
|
{
|
||||||
int fd = source->fd;
|
int fd = source->fd;
|
||||||
|
|
|
@ -152,7 +152,8 @@ void htdocs_on_request_recv_callback
|
||||||
(spdylay_session *session, int32_t stream_id, void *user_data);
|
(spdylay_session *session, int32_t stream_id, void *user_data);
|
||||||
|
|
||||||
ssize_t file_read_callback
|
ssize_t file_read_callback
|
||||||
(spdylay_session *session, uint8_t *buf, size_t length, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t length, int *eof,
|
||||||
spdylay_data_source *source, void *user_data);
|
spdylay_data_source *source, void *user_data);
|
||||||
|
|
||||||
} // namespace spdylay
|
} // namespace spdylay
|
||||||
|
|
|
@ -135,7 +135,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
ssize_t string_read_callback
|
ssize_t string_read_callback
|
||||||
(spdylay_session *session, uint8_t *buf, size_t length, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t length, int *eof,
|
||||||
spdylay_data_source *source, void *user_data)
|
spdylay_data_source *source, void *user_data)
|
||||||
{
|
{
|
||||||
std::pair<std::string, size_t>& body_pair =
|
std::pair<std::string, size_t>& body_pair =
|
||||||
|
|
|
@ -182,20 +182,22 @@ typedef union {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback function invoked when the library wants to read data from
|
* Callback function invoked when the library wants to read data from
|
||||||
* |source|. The implementation of this function must read at most
|
* |source|. The read data is sent in the stream |stream_id|. The
|
||||||
* |length| bytes of data from |source| (or possibly other places) and
|
* implementation of this function must read at most |length| bytes of
|
||||||
* store them in |buf| and return number of data stored in |buf|. If
|
* data from |source| (or possibly other places) and store them in
|
||||||
* EOF is reached, set |*eof| to 1. If the application wants to
|
* |buf| and return number of data stored in |buf|. If EOF is reached,
|
||||||
* postpone DATA frames, (e.g., asynchronous I/O, or reading data
|
* set |*eof| to 1. If the application wants to postpone DATA frames,
|
||||||
* blocks for long time), it is achieved by returning
|
* (e.g., asynchronous I/O, or reading data blocks for long time), it
|
||||||
* SPDYLAY_ERR_DEFERRED without reading any data in this invocation.
|
* is achieved by returning SPDYLAY_ERR_DEFERRED without reading any
|
||||||
* The library removes DATA frame from outgoing queue temporarily. To
|
* data in this invocation. The library removes DATA frame from
|
||||||
* move back deferred DATA frame to outgoing queue, call
|
* outgoing queue temporarily. To move back deferred DATA frame to
|
||||||
* spdylay_session_resume_data(). In case of error, return
|
* outgoing queue, call spdylay_session_resume_data(). In case of
|
||||||
* SPDYLAY_ERR_CALLBACK_FAILURE, which leads to session failure.
|
* error, return SPDYLAY_ERR_CALLBACK_FAILURE, which leads to session
|
||||||
|
* failure.
|
||||||
*/
|
*/
|
||||||
typedef ssize_t (*spdylay_data_source_read_callback)
|
typedef ssize_t (*spdylay_data_source_read_callback)
|
||||||
(spdylay_session *session, uint8_t *buf, size_t length, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t length, int *eof,
|
||||||
spdylay_data_source *source, void *user_data);
|
spdylay_data_source *source, void *user_data);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1686,7 +1686,8 @@ ssize_t spdylay_session_pack_data_overwrite(spdylay_session *session,
|
||||||
int eof = 0;
|
int eof = 0;
|
||||||
uint8_t flags = 0;
|
uint8_t flags = 0;
|
||||||
r = frame->data_prd.read_callback
|
r = frame->data_prd.read_callback
|
||||||
(session, buf+8, len-8, &eof, &frame->data_prd.source, session->user_data);
|
(session, frame->stream_id, buf+8, len-8, &eof, &frame->data_prd.source,
|
||||||
|
session->user_data);
|
||||||
if(r < 0) {
|
if(r < 0) {
|
||||||
return r;
|
return r;
|
||||||
} else if(len < r) {
|
} else if(len < r) {
|
||||||
|
|
|
@ -138,7 +138,8 @@ static void on_ctrl_send_callback(spdylay_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fixed_length_data_source_read_callback
|
static ssize_t fixed_length_data_source_read_callback
|
||||||
(spdylay_session *session, uint8_t *buf, size_t len, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t len, int *eof,
|
||||||
spdylay_data_source *source, void *user_data)
|
spdylay_data_source *source, void *user_data)
|
||||||
{
|
{
|
||||||
my_user_data *ud = (my_user_data*)user_data;
|
my_user_data *ud = (my_user_data*)user_data;
|
||||||
|
@ -1274,7 +1275,8 @@ void test_spdylay_session_recv_invalid_frame()
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t defer_data_source_read_callback
|
static ssize_t defer_data_source_read_callback
|
||||||
(spdylay_session *session, uint8_t *buf, size_t len, int *eof,
|
(spdylay_session *session, int32_t stream_id,
|
||||||
|
uint8_t *buf, size_t len, int *eof,
|
||||||
spdylay_data_source *source, void *user_data)
|
spdylay_data_source *source, void *user_data)
|
||||||
{
|
{
|
||||||
return SPDYLAY_ERR_DEFERRED;
|
return SPDYLAY_ERR_DEFERRED;
|
||||||
|
|
Loading…
Reference in New Issue