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
a4528930
Commit
a4528930
authored
Feb 28, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the potential dead lock in flow control.
parent
3d1b4118
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
29 deletions
+25
-29
lib/spdylay_session.c
lib/spdylay_session.c
+25
-29
No files found.
lib/spdylay_session.c
View file @
a4528930
...
...
@@ -489,20 +489,20 @@ static int spdylay_session_is_window_update_allowed(spdylay_session *session,
}
/*
* Returns the available window size.
* Returns the maximum length of next data read. If the flow control
* is enabled, the return value takes into account the current window
* size.
*/
static
size_t
spdylay_session_
avail_window
(
spdylay_session
*
session
,
spdylay_stream
*
stream
)
static
size_t
spdylay_session_
next_data_read
(
spdylay_session
*
session
,
spdylay_stream
*
stream
)
{
if
(
session
->
flow_control
==
0
)
{
return
SPDYLAY_DATA_PAYLOAD_LENGTH
;
}
else
if
(
stream
->
window_size
>
0
)
{
return
stream
->
window_size
<
SPDYLAY_DATA_PAYLOAD_LENGTH
?
stream
->
window_size
:
SPDYLAY_DATA_PAYLOAD_LENGTH
;
}
else
{
if
(
stream
->
window_size
>=
SPDYLAY_DATA_PAYLOAD_LENGTH
||
stream
->
initial_window_size
<
stream
->
window_size
*
2
)
{
return
stream
->
window_size
;
}
else
{
return
0
;
}
return
0
;
}
}
...
...
@@ -660,7 +660,7 @@ static ssize_t spdylay_session_prep_frame(spdylay_session *session,
}
break
;
case
SPDYLAY_DATA
:
{
size_t
avail_window
;
size_t
next_readmax
;
spdylay_stream
*
stream
;
if
(
!
spdylay_session_is_data_allowed
(
session
,
item
->
frame
->
data
.
stream_id
))
{
return
SPDYLAY_ERR_INVALID_FRAME
;
...
...
@@ -668,18 +668,16 @@ static ssize_t spdylay_session_prep_frame(spdylay_session *session,
stream
=
spdylay_session_get_stream
(
session
,
item
->
frame
->
data
.
stream_id
);
/* Assuming stream is not NULL */
assert
(
stream
);
avail_window
=
spdylay_session_avail_window
(
session
,
stream
);
if
(
avail_window
==
0
)
{
next_readmax
=
spdylay_session_next_data_read
(
session
,
stream
);
if
(
next_readmax
==
0
)
{
spdylay_stream_defer_data
(
stream
,
item
,
SPDYLAY_DEFERRED_FLOW_CONTROL
);
return
SPDYLAY_ERR_DEFERRED
;
}
framebuflen
=
spdylay_session_pack_data
(
session
,
&
session
->
aob
.
framebuf
,
&
session
->
aob
.
framebufmax
,
(
avail_window
<
SPDYLAY_DATA_PAYLOAD_LENGTH
)
?
avail_window
:
SPDYLAY_DATA_PAYLOAD_LENGTH
,
&
item
->
frame
->
data
);
framebuflen
=
spdylay_session_pack_data
(
session
,
&
session
->
aob
.
framebuf
,
&
session
->
aob
.
framebufmax
,
next_readmax
,
&
item
->
frame
->
data
);
if
(
framebuflen
==
SPDYLAY_ERR_DEFERRED
)
{
spdylay_stream_defer_data
(
stream
,
item
,
SPDYLAY_DEFERRED_NONE
);
return
SPDYLAY_ERR_DEFERRED
;
...
...
@@ -927,26 +925,24 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
waiting at the top of the queue, we continue to send this
data. */
if
(
item
==
NULL
||
session
->
aob
.
item
->
pri
<=
item
->
pri
)
{
size_t
avail_window
;
size_t
next_readmax
;
spdylay_stream
*
stream
;
stream
=
spdylay_session_get_stream
(
session
,
frame
->
data
.
stream_id
);
/* Assuming stream is not NULL */
assert
(
stream
);
avail_window
=
spdylay_session_avail_window
(
session
,
stream
);
if
(
avail_window
==
0
)
{
next_readmax
=
spdylay_session_next_data_read
(
session
,
stream
);
if
(
next_readmax
==
0
)
{
spdylay_stream_defer_data
(
stream
,
session
->
aob
.
item
,
SPDYLAY_DEFERRED_FLOW_CONTROL
);
session
->
aob
.
item
=
NULL
;
spdylay_active_outbound_item_reset
(
&
session
->
aob
);
return
0
;
}
r
=
spdylay_session_pack_data
(
session
,
&
session
->
aob
.
framebuf
,
&
session
->
aob
.
framebufmax
,
(
avail_window
<
SPDYLAY_DATA_PAYLOAD_LENGTH
?
avail_window
:
SPDYLAY_DATA_PAYLOAD_LENGTH
),
&
frame
->
data
);
r
=
spdylay_session_pack_data
(
session
,
&
session
->
aob
.
framebuf
,
&
session
->
aob
.
framebufmax
,
next_readmax
,
&
frame
->
data
);
if
(
r
==
SPDYLAY_ERR_DEFERRED
)
{
spdylay_stream_defer_data
(
stream
,
session
->
aob
.
item
,
SPDYLAY_DEFERRED_NONE
);
...
...
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