Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
77dedbef
Unverified
Commit
77dedbef
authored
Jan 25, 2019
by
Zhangyi Chen
Committed by
GitHub
Jan 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #632 from zyearn/fix_h2_big_response_not_sending
fix h2 big response not sending bug
parents
45938762
e1d1d9af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+20
-13
No files found.
src/brpc/policy/http2_rpc_protocol.cpp
View file @
77dedbef
...
...
@@ -1522,26 +1522,26 @@ H2UnsentRequest::AppendAndDestroySelf(butil::IOBuf* out, Socket* socket) {
<<
" h2req="
<<
(
StreamUserData
*
)
this
;
return
butil
::
Status
(
EH2RUNOUTSTREAMS
,
"Fail to allocate stream_id"
);
}
H2StreamContext
*
sctx
=
_sctx
.
release
();
sctx
->
Init
(
ctx
,
id
);
const
int
rc
=
ctx
->
TryToInsertStream
(
id
,
sctx
);
if
(
rc
<
0
)
{
delete
sctx
;
return
butil
::
Status
(
EINTERNAL
,
"Fail to insert existing stream_id"
);
}
else
if
(
rc
>
0
)
{
delete
sctx
;
return
butil
::
Status
(
ELOGOFF
,
"the connection just issued GOAWAY"
);
}
_stream_id
=
sctx
->
stream_id
();
_sctx
->
Init
(
ctx
,
id
);
// flow control
if
(
!
_cntl
->
request_attachment
().
empty
())
{
const
int64_t
data_size
=
_cntl
->
request_attachment
().
size
();
if
(
!
sctx
->
ConsumeWindowSize
(
data_size
))
{
if
(
!
_
sctx
->
ConsumeWindowSize
(
data_size
))
{
return
butil
::
Status
(
ELIMIT
,
"remote_window_left is not enough, data_size=%"
PRId64
,
data_size
);
}
}
const
int
rc
=
ctx
->
TryToInsertStream
(
id
,
_sctx
.
get
());
if
(
rc
<
0
)
{
return
butil
::
Status
(
EINTERNAL
,
"Fail to insert existing stream_id"
);
}
else
if
(
rc
>
0
)
{
return
butil
::
Status
(
ELOGOFF
,
"the connection just issued GOAWAY"
);
}
_stream_id
=
_sctx
->
stream_id
();
// After calling TryToInsertStream, the ownership of _sctx is transferred to ctx
_sctx
.
release
();
HPacker
&
hpacker
=
ctx
->
hpacker
();
butil
::
IOBufAppender
appender
;
HPackOptions
options
;
...
...
@@ -1672,8 +1672,15 @@ H2UnsentResponse::AppendAndDestroySelf(butil::IOBuf* out, Socket* socket) {
// NOTE: Currently the stream context is definitely removed and updating
// window size is useless, however it's not true when progressive request
// is supported.
// TODO(zhujiashun): Instead of just returning error to client, a better
// solution to handle not enough window size is to wait until WINDOW_UPDATE
// is received, and then retry those failed response again.
if
(
!
MinusWindowSize
(
&
ctx
->
_remote_window_left
,
_data
.
size
()))
{
return
butil
::
Status
(
ELIMIT
,
"Remote window size is not enough"
);
char
rstbuf
[
FRAME_HEAD_SIZE
+
4
];
SerializeFrameHead
(
rstbuf
,
4
,
H2_FRAME_RST_STREAM
,
0
,
_stream_id
);
SaveUint32
(
rstbuf
+
FRAME_HEAD_SIZE
,
H2_FLOW_CONTROL_ERROR
);
out
->
append
(
rstbuf
,
sizeof
(
rstbuf
));
return
butil
::
Status
::
OK
();
}
HPacker
&
hpacker
=
ctx
->
hpacker
();
...
...
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