mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-24 00:10:12 +00:00
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
|
||||
|
||||
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)
|
||||
{
|
||||
int fd = source->fd;
|
||||
|
@ -152,7 +152,8 @@ void htdocs_on_request_recv_callback
|
||||
(spdylay_session *session, int32_t stream_id, void *user_data);
|
||||
|
||||
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);
|
||||
|
||||
} // namespace spdylay
|
||||
|
@ -135,7 +135,8 @@ private:
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
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
|
||||
* |source|. The implementation of this function must read at most
|
||||
* |length| bytes of data from |source| (or possibly other places) and
|
||||
* store them in |buf| and return number of data stored in |buf|. If
|
||||
* EOF is reached, set |*eof| to 1. If the application wants to
|
||||
* postpone DATA frames, (e.g., asynchronous I/O, or reading data
|
||||
* blocks for long time), it is achieved by returning
|
||||
* SPDYLAY_ERR_DEFERRED without reading any data in this invocation.
|
||||
* The library removes DATA frame from outgoing queue temporarily. To
|
||||
* move back deferred DATA frame to outgoing queue, call
|
||||
* spdylay_session_resume_data(). In case of error, return
|
||||
* SPDYLAY_ERR_CALLBACK_FAILURE, which leads to session failure.
|
||||
* |source|. The read data is sent in the stream |stream_id|. The
|
||||
* implementation of this function must read at most |length| bytes of
|
||||
* data from |source| (or possibly other places) and store them in
|
||||
* |buf| and return number of data stored in |buf|. If EOF is reached,
|
||||
* set |*eof| to 1. If the application wants to postpone DATA frames,
|
||||
* (e.g., asynchronous I/O, or reading data blocks for long time), it
|
||||
* is achieved by returning SPDYLAY_ERR_DEFERRED without reading any
|
||||
* data in this invocation. The library removes DATA frame from
|
||||
* outgoing queue temporarily. To move back deferred DATA frame to
|
||||
* outgoing queue, call spdylay_session_resume_data(). In case of
|
||||
* error, return SPDYLAY_ERR_CALLBACK_FAILURE, which leads to session
|
||||
* failure.
|
||||
*/
|
||||
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);
|
||||
|
||||
typedef struct {
|
||||
|
@ -1686,7 +1686,8 @@ ssize_t spdylay_session_pack_data_overwrite(spdylay_session *session,
|
||||
int eof = 0;
|
||||
uint8_t flags = 0;
|
||||
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) {
|
||||
return 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
|
||||
(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)
|
||||
{
|
||||
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
|
||||
(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)
|
||||
{
|
||||
return SPDYLAY_ERR_DEFERRED;
|
||||
|
Loading…
Reference in New Issue
Block a user