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
7f5a8739
Commit
7f5a8739
authored
Jan 27, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor a bit
parent
a3193bee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
19 deletions
+39
-19
lib/nghttp2_frame.c
lib/nghttp2_frame.c
+10
-0
lib/nghttp2_frame.h
lib/nghttp2_frame.h
+2
-0
lib/nghttp2_session.c
lib/nghttp2_session.c
+27
-19
No files found.
lib/nghttp2_frame.c
View file @
7f5a8739
...
...
@@ -181,6 +181,16 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame,
void
nghttp2_frame_window_update_free
(
nghttp2_window_update
*
frame
)
{}
void
nghttp2_frame_data_init
(
nghttp2_data
*
frame
,
nghttp2_private_data
*
pdata
)
{
frame
->
hd
=
pdata
->
hd
;
/* flags may have NGHTTP2_FLAG_END_STREAM even if the sent chunk
is not the end of the stream */
if
(
!
pdata
->
eof
)
{
frame
->
hd
.
flags
&=
~
NGHTTP2_FLAG_END_STREAM
;
}
}
void
nghttp2_frame_private_data_init
(
nghttp2_private_data
*
frame
,
uint8_t
flags
,
int32_t
stream_id
,
...
...
lib/nghttp2_frame.h
View file @
7f5a8739
...
...
@@ -416,6 +416,8 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame,
void
nghttp2_frame_window_update_free
(
nghttp2_window_update
*
frame
);
void
nghttp2_frame_data_init
(
nghttp2_data
*
frame
,
nghttp2_private_data
*
pdata
);
void
nghttp2_frame_private_data_init
(
nghttp2_private_data
*
frame
,
uint8_t
flags
,
int32_t
stream_id
,
...
...
lib/nghttp2_session.c
View file @
7f5a8739
...
...
@@ -1387,6 +1387,25 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item
}
}
static
int
session_call_before_frame_send
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
)
{
int
rv
;
if
(
session
->
callbacks
.
before_frame_send_callback
)
{
/* Adjust frame length to deal with CONTINUATION frame */
size_t
origlen
=
frame
->
hd
.
length
;
frame
->
hd
.
length
=
session
->
aob
.
framebuflen
-
NGHTTP2_FRAME_HEAD_LENGTH
;
rv
=
session
->
callbacks
.
before_frame_send_callback
(
session
,
frame
,
session
->
user_data
);
frame
->
hd
.
length
=
origlen
;
if
(
rv
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
}
return
0
;
}
static
int
session_call_on_frame_send
(
nghttp2_session
*
session
,
nghttp2_frame
*
frame
)
{
...
...
@@ -1584,12 +1603,8 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
data_frame
=
nghttp2_outbound_item_get_data_frame
(
session
->
aob
.
item
);
if
(
session
->
callbacks
.
on_frame_send_callback
)
{
nghttp2_frame
public_data_frame
=
{
data_frame
->
hd
};
/* flags may have NGHTTP2_FLAG_END_STREAM even if the sent chunk
is not the end of the stream */
if
(
!
data_frame
->
eof
)
{
public_data_frame
.
hd
.
flags
&=
~
NGHTTP2_FLAG_END_STREAM
;
}
nghttp2_frame
public_data_frame
;
nghttp2_frame_data_init
(
&
public_data_frame
.
data
,
data_frame
);
rv
=
session_call_on_frame_send
(
session
,
&
public_data_frame
);
if
(
nghttp2_is_fatal
(
rv
))
{
return
rv
;
...
...
@@ -1737,22 +1752,15 @@ int nghttp2_session_send(nghttp2_session *session)
nghttp2_frame
*
frame
=
nghttp2_outbound_item_get_ctrl_frame
(
item
);
session
->
aob
.
framebufmark
=
frame
->
hd
.
length
+
NGHTTP2_FRAME_HEAD_LENGTH
;
/* Call before_send callback */
if
(
session
->
callbacks
.
before_frame_send_callback
)
{
size_t
origlen
=
frame
->
hd
.
length
;
frame
->
hd
.
length
=
session
->
aob
.
framebuflen
-
NGHTTP2_FRAME_HEAD_LENGTH
;
r
=
session
->
callbacks
.
before_frame_send_callback
(
session
,
frame
,
session
->
user_data
);
frame
->
hd
.
length
=
origlen
;
if
(
r
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
r
=
session_call_before_frame_send
(
session
,
frame
);
if
(
nghttp2_is_fatal
(
r
))
{
return
r
;
}
}
else
{
nghttp2_private_data
*
frame
;
frame
=
nghttp2_outbound_item_get_data_frame
(
session
->
aob
.
item
);
session
->
aob
.
framebufmark
=
nghttp2_outbound_item_get_data_frame
(
session
->
aob
.
item
)
->
hd
.
length
+
NGHTTP2_FRAME_HEAD_LENGTH
;
frame
->
hd
.
length
+
NGHTTP2_FRAME_HEAD_LENGTH
;
}
}
data
=
session
->
aob
.
framebuf
+
session
->
aob
.
framebufoff
;
...
...
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