Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
544ac9f6
Commit
544ac9f6
authored
Aug 29, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add int return value to nghttp2_on_data_recv_callback
parent
972b47d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
11 deletions
+23
-11
lib/includes/nghttp2/nghttp2.h
lib/includes/nghttp2/nghttp2.h
+6
-1
lib/nghttp2_session.c
lib/nghttp2_session.c
+8
-4
src/HttpServer.cc
src/HttpServer.cc
+2
-1
src/app_helper.cc
src/app_helper.cc
+2
-1
src/app_helper.h
src/app_helper.h
+1
-1
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+4
-3
No files found.
lib/includes/nghttp2/nghttp2.h
View file @
544ac9f6
...
...
@@ -832,8 +832,13 @@ typedef int (*nghttp2_on_data_chunk_recv_callback)
* Callback function invoked when DATA frame is received. The actual
* data it contains are received by
* :type:`nghttp2_on_data_chunk_recv_callback`.
*
* The implementation of this function must return 0 if it
* succeeds. If nonzero is returned, it is treated as fatal error and
* `nghttp2_session_recv()` and `nghttp2_session_send()` functions
* immediately return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
typedef
void
(
*
nghttp2_on_data_recv_callback
)
typedef
int
(
*
nghttp2_on_data_recv_callback
)
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
);
...
...
lib/nghttp2_session.c
View file @
544ac9f6
...
...
@@ -2626,8 +2626,10 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
if
(
stream
->
state
==
NGHTTP2_STREAM_OPENED
)
{
valid
=
1
;
if
(
session
->
callbacks
.
on_data_recv_callback
)
{
session
->
callbacks
.
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
session
->
user_data
);
if
(
session
->
callbacks
.
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
session
->
user_data
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
error_code
=
NGHTTP2_PROTOCOL_ERROR
;
...
...
@@ -2641,8 +2643,10 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
NGHTTP2_STREAM_CLOSING state. This is a race condition. */
valid
=
1
;
if
(
session
->
callbacks
.
on_data_recv_callback
)
{
session
->
callbacks
.
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
session
->
user_data
);
if
(
session
->
callbacks
.
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
session
->
user_data
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
if
(
flags
&
NGHTTP2_FLAG_END_STREAM
)
{
nghttp2_session_call_on_request_recv
(
session
,
stream_id
);
...
...
src/HttpServer.cc
View file @
544ac9f6
...
...
@@ -762,7 +762,7 @@ int on_data_chunk_recv_callback
}
// namespace
namespace
{
void
hd_on_data_recv_callback
int
hd_on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
{
...
...
@@ -772,6 +772,7 @@ void hd_on_data_recv_callback
print_session_id
(
hd
->
session_id
());
on_data_recv_callback
(
session
,
length
,
flags
,
stream_id
,
user_data
);
}
return
0
;
}
}
// namespace
...
...
src/app_helper.cc
View file @
544ac9f6
...
...
@@ -413,7 +413,7 @@ void print_data_frame(print_type ptype, uint16_t length, uint8_t flags,
}
}
// namespace
void
on_data_recv_callback
int
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
{
...
...
@@ -421,6 +421,7 @@ void on_data_recv_callback
printf
(
" recv "
);
print_data_frame
(
PRINT_RECV
,
length
,
flags
,
stream_id
);
fflush
(
stdout
);
return
0
;
}
void
on_data_send_callback
...
...
src/app_helper.h
View file @
544ac9f6
...
...
@@ -64,7 +64,7 @@ void on_unknown_frame_recv_callback(nghttp2_session *session,
void
on_frame_send_callback
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
,
void
*
user_data
);
void
on_data_recv_callback
int
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
);
...
...
tests/nghttp2_session_test.c
View file @
544ac9f6
...
...
@@ -175,12 +175,13 @@ static int on_data_chunk_recv_callback(nghttp2_session *session,
return
0
;
}
static
void
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
static
int
on_data_recv_callback
(
nghttp2_session
*
session
,
uint16_t
length
,
uint8_t
flags
,
int32_t
stream_id
,
void
*
user_data
)
{
my_user_data
*
ud
=
(
my_user_data
*
)
user_data
;
++
ud
->
data_recv_cb_called
;
return
0
;
}
static
ssize_t
fixed_length_data_source_read_callback
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment