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
513ed819
Commit
513ed819
authored
Sep 21, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues around WINDOW_UPDATE & rpc-timeout does not close the connection
parent
9cf3f779
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
http2.cpp
src/brpc/http2.cpp
+2
-1
http2.h
src/brpc/http2.h
+7
-1
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+0
-0
http2_rpc_protocol.h
src/brpc/policy/http2_rpc_protocol.h
+18
-7
No files found.
src/brpc/http2.cpp
View file @
513ed819
...
...
@@ -137,7 +137,7 @@ size_t H2Settings::ByteSize() const {
return
size
;
}
void
H2Settings
::
SerializeTo
(
void
*
out
)
const
{
size_t
H2Settings
::
SerializeTo
(
void
*
out
)
const
{
uint8_t
*
p
=
(
uint8_t
*
)
out
;
if
(
header_table_size
!=
DEFAULT_HEADER_TABLE_SIZE
)
{
SaveUint16
(
p
,
HTTP2_SETTINGS_HEADER_TABLE_SIZE
);
...
...
@@ -169,6 +169,7 @@ void H2Settings::SerializeTo(void* out) const {
SaveUint32
(
p
+
2
,
max_header_list_size
);
p
+=
6
;
}
return
static_cast
<
size_t
>
(
p
-
(
uint8_t
*
)
out
);
}
void
H2Settings
::
Print
(
std
::
ostream
&
os
)
const
{
...
...
src/brpc/http2.h
View file @
513ed819
...
...
@@ -90,10 +90,16 @@ struct H2Settings {
// Parse from n bytes from the iterator.
// Returns true on success.
bool
ParseFrom
(
butil
::
IOBufBytesIterator
&
,
size_t
n
);
// Bytes of serialized data.
size_t
ByteSize
()
const
;
// Maximum value that may be returned by ByteSize().
static
const
size_t
MAX_BYTE_SIZE
=
36
;
// Serialize to `out' which is at least ByteSize() bytes long.
void
SerializeTo
(
void
*
out
)
const
;
// Returns bytes written.
size_t
SerializeTo
(
void
*
out
)
const
;
void
Print
(
std
::
ostream
&
)
const
;
};
...
...
src/brpc/policy/http2_rpc_protocol.cpp
View file @
513ed819
This diff is collapsed.
Click to expand it.
src/brpc/policy/http2_rpc_protocol.h
View file @
513ed819
...
...
@@ -24,7 +24,10 @@
#include "brpc/details/hpack.h"
#include "brpc/stream_creator.h"
#include "brpc/controller.h"
#ifndef NDEBUG
#include "bvar/bvar.h"
#endif
namespace
brpc
{
...
...
@@ -159,8 +162,8 @@ public:
void
Destroy
();
void
Describe
(
butil
::
IOBuf
*
)
const
;
// @SocketMessage
butil
::
Status
AppendAndDestroySelf
(
butil
::
IOBuf
*
out
,
Socket
*
);
size_t
EstimatedByteSize
();
butil
::
Status
AppendAndDestroySelf
(
butil
::
IOBuf
*
out
,
Socket
*
)
override
;
size_t
EstimatedByteSize
()
override
;
private
:
std
::
string
&
push
(
const
std
::
string
&
name
)
...
...
@@ -214,19 +217,28 @@ public:
size_t
parsed_length
()
const
{
return
this
->
_parsed_length
;
}
int
stream_id
()
const
{
return
header
().
h2_stream_id
();
}
#ifdef HAS_H2_STREAM_STATE
int64_t
ReleaseDeferredWindowUpdate
()
{
if
(
_deferred_window_update
.
load
(
butil
::
memory_order_relaxed
)
==
0
)
{
return
0
;
}
return
_deferred_window_update
.
exchange
(
0
,
butil
::
memory_order_relaxed
);
}
bool
ConsumeWindowSize
(
int64_t
size
);
#if defined(BRPC_H2_STREAM_STATE)
H2StreamState
state
()
const
{
return
_state
;
}
void
SetState
(
H2StreamState
state
);
#endif
friend
class
H2Context
;
H2Context
*
_conn_ctx
;
#if
def HAS_H2_STREAM_STATE
#if
defined(BRPC_H2_STREAM_STATE)
H2StreamState
_state
;
#endif
bool
_stream_ended
;
butil
::
atomic
<
int64_t
>
_remote_window_
size
;
butil
::
atomic
<
int64_t
>
_
local_window_siz
e
;
butil
::
atomic
<
int64_t
>
_remote_window_
left
;
butil
::
atomic
<
int64_t
>
_
deferred_window_updat
e
;
uint64_t
_correlation_id
;
butil
::
IOBuf
_remaining_header_fragment
;
};
...
...
@@ -250,7 +262,6 @@ protected:
};
}
// namespace policy
}
// namespace brpc
#endif // BAIDU_RPC_POLICY_HTTP2_RPC_PROTOCOL_H
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