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
6e12291a
Commit
6e12291a
authored
Jan 29, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added spdylay_on_stream_close_callback
parent
bf1be485
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
10 deletions
+32
-10
lib/includes/spdylay/spdylay.h
lib/includes/spdylay/spdylay.h
+10
-0
lib/spdylay_session.c
lib/spdylay_session.c
+15
-5
lib/spdylay_session.h
lib/spdylay_session.h
+7
-5
No files found.
lib/includes/spdylay/spdylay.h
View file @
6e12291a
...
...
@@ -78,6 +78,7 @@ typedef enum {
}
spdylay_flag
;
typedef
enum
{
SPDYLAY_OK
=
0
,
SPDYLAY_PROTOCOL_ERROR
=
1
,
SPDYLAY_INVALID_STREAM
=
2
,
SPDYLAY_REFUSED_STREAM
=
3
,
...
...
@@ -256,6 +257,14 @@ typedef void (*spdylay_before_ctrl_send_callback)
(
spdylay_session
*
session
,
spdylay_frame_type
type
,
spdylay_frame
*
frame
,
void
*
user_data
);
/*
* Callback function invoked when stream |stream_id| is closed. The
* reason of closure is indicated by |status_code|.
*/
typedef
void
(
*
spdylay_on_stream_close_callback
)
(
spdylay_session
*
session
,
int32_t
stream_id
,
spdylay_status_code
status_code
,
void
*
user_data
);
typedef
struct
{
spdylay_send_callback
send_callback
;
spdylay_recv_callback
recv_callback
;
...
...
@@ -267,6 +276,7 @@ typedef struct {
spdylay_before_ctrl_send_callback
before_ctrl_send_callback
;
spdylay_on_ctrl_send_callback
on_ctrl_send_callback
;
spdylay_on_data_send_callback
on_data_send_callback
;
spdylay_on_stream_close_callback
on_stream_close_callback
;
}
spdylay_session_callbacks
;
/*
...
...
lib/spdylay_session.c
View file @
6e12291a
...
...
@@ -286,11 +286,18 @@ spdylay_stream* spdylay_session_open_stream(spdylay_session *session,
return
stream
;
}
int
spdylay_session_close_stream
(
spdylay_session
*
session
,
int32_t
stream_id
)
int
spdylay_session_close_stream
(
spdylay_session
*
session
,
int32_t
stream_id
,
spdylay_status_code
status_code
)
{
spdylay_stream
*
stream
=
spdylay_session_get_stream
(
session
,
stream_id
);
if
(
stream
)
{
spdylay_map_erase
(
&
session
->
streams
,
stream_id
);
if
(
stream
->
state
!=
SPDYLAY_STREAM_INITIAL
&&
session
->
callbacks
.
on_stream_close_callback
)
{
session
->
callbacks
.
on_stream_close_callback
(
session
,
stream_id
,
status_code
,
session
->
user_data
);
}
spdylay_stream_free
(
stream
);
free
(
stream
);
return
0
;
...
...
@@ -303,7 +310,8 @@ int spdylay_session_close_stream_if_shut_rdwr(spdylay_session *session,
spdylay_stream
*
stream
)
{
if
((
stream
->
shut_flags
&
SPDYLAY_SHUT_RDWR
)
==
SPDYLAY_SHUT_RDWR
)
{
return
spdylay_session_close_stream
(
session
,
stream
->
stream_id
);
return
spdylay_session_close_stream
(
session
,
stream
->
stream_id
,
SPDYLAY_OK
);
}
else
{
return
0
;
}
...
...
@@ -381,7 +389,7 @@ ssize_t spdylay_session_prep_frame(spdylay_session *session,
r
=
spdylay_submit_data
(
session
,
stream_id
,
data_prd
);
if
(
r
!=
0
)
{
free
(
framebuf
);
spdylay_session_close_stream
(
session
,
stream_id
);
spdylay_session_close_stream
(
session
,
stream_id
,
SPDYLAY_OK
);
return
r
;
}
}
...
...
@@ -506,7 +514,8 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
break
;
}
case
SPDYLAY_RST_STREAM
:
spdylay_session_close_stream
(
session
,
frame
->
rst_stream
.
stream_id
);
spdylay_session_close_stream
(
session
,
frame
->
rst_stream
.
stream_id
,
frame
->
rst_stream
.
status_code
);
break
;
case
SPDYLAY_NOOP
:
/* We don't have any public API to add NOOP, so here is
...
...
@@ -835,7 +844,8 @@ int spdylay_session_on_syn_reply_received(spdylay_session *session,
int
spdylay_session_on_rst_stream_received
(
spdylay_session
*
session
,
spdylay_frame
*
frame
)
{
spdylay_session_close_stream
(
session
,
frame
->
rst_stream
.
stream_id
);
spdylay_session_close_stream
(
session
,
frame
->
rst_stream
.
stream_id
,
frame
->
rst_stream
.
status_code
);
return
0
;
}
...
...
lib/spdylay_session.h
View file @
6e12291a
...
...
@@ -159,12 +159,14 @@ spdylay_stream* spdylay_session_open_stream(spdylay_session *session,
spdylay_stream_state
initial_state
);
/*
* Closes stream whose stream ID is |stream_id|. This function returns
* 0 if it succeeds, or negative error code. The possible error code
* is SPDYLAY_ERR_INVALID_ARGUMENT, which is used when stream
* |stream_id| does not exist. So the caller may ignore this error.
* Closes stream whose stream ID is |stream_id|. The reason of closure
* is indicated by |status_code|. This function returns 0 if it
* succeeds, or negative error code. The possible error code is
* SPDYLAY_ERR_INVALID_ARGUMENT, which is used when stream |stream_id|
* does not exist. So the caller may ignore this error.
*/
int
spdylay_session_close_stream
(
spdylay_session
*
session
,
int32_t
stream_id
);
int
spdylay_session_close_stream
(
spdylay_session
*
session
,
int32_t
stream_id
,
spdylay_status_code
status_code
);
/*
* If further receptions and transmissions over this stream are
...
...
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