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
925078c1
Commit
925078c1
authored
Jan 29, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added handling of EOF from recv_callback
parent
06dae79b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
lib/includes/spdylay/spdylay.h
lib/includes/spdylay/spdylay.h
+9
-0
lib/spdylay_session.c
lib/spdylay_session.c
+5
-7
No files found.
lib/includes/spdylay/spdylay.h
View file @
925078c1
...
...
@@ -45,6 +45,7 @@ typedef enum {
SPDYLAY_ERR_WOULDBLOCK
=
-
504
,
SPDYLAY_ERR_PROTO
=
-
505
,
SPDYLAY_ERR_INVALID_FRAME
=
-
506
,
SPDYLAY_ERR_EOF
=
-
507
,
/* The errors < SPDYLAY_ERR_FATAL mean that the library is under
unexpected condition that it cannot process any further data
...
...
@@ -165,6 +166,14 @@ typedef ssize_t (*spdylay_send_callback)
(
spdylay_session
*
session
,
const
uint8_t
*
data
,
size_t
length
,
int
flags
,
void
*
user_data
);
/*
* Callback function invoked when the library want to read data from
* remote peer. The implementation of this function must read at most
* |length| bytes of data and store it in |buf|. It must return the
* number of bytes written in |buf| if it succeeds. If it gets EOF
* before it reads any single byte, return SPDYLAY_ERR_EOF. For other
* errors, return SPDYLAY_ERR_CALLBACK_FAILURE.
*/
typedef
ssize_t
(
*
spdylay_recv_callback
)
(
spdylay_session
*
session
,
uint8_t
*
buf
,
size_t
length
,
int
flags
,
void
*
user_data
);
...
...
lib/spdylay_session.c
View file @
925078c1
...
...
@@ -1077,7 +1077,7 @@ int spdylay_session_recv(spdylay_session *session)
uint32_t
payloadlen
;
if
(
spdylay_inbound_buffer_avail
(
&
session
->
ibuf
)
<
SPDYLAY_HEAD_LEN
)
{
r
=
spdylay_recv
(
session
);
/*
TODO handle
EOF */
/*
If EOF is reached, r == SPDYLAY_ERR_
EOF */
if
(
r
<
0
)
{
if
(
r
==
SPDYLAY_ERR_WOULDBLOCK
)
{
return
0
;
...
...
@@ -1114,12 +1114,10 @@ int spdylay_session_recv(spdylay_session *session)
if
(
spdylay_inbound_buffer_avail
(
&
session
->
ibuf
)
==
0
&&
rempayloadlen
>
0
)
{
r
=
spdylay_recv
(
session
);
if
(
r
<=
0
)
{
if
(
r
==
SPDYLAY_ERR_WOULDBLOCK
)
{
return
0
;
}
else
{
return
r
;
}
if
(
r
==
0
||
r
==
SPDYLAY_ERR_WOULDBLOCK
)
{
return
0
;
}
else
if
(
r
<
0
)
{
return
r
;
}
}
bufavail
=
spdylay_inbound_buffer_avail
(
&
session
->
ibuf
);
...
...
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