MCPcopy Create free account
hub / github.com/apache/brpc / OnWindowUpdate

Method OnWindowUpdate

src/brpc/policy/http2_rpc_protocol.cpp:1008–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006}
1007
1008H2ParseResult H2Context::OnWindowUpdate(
1009 butil::IOBufBytesIterator& it, const H2FrameHead& frame_head) {
1010 if (frame_head.payload_size != 4) {
1011 LOG(ERROR) << "Invalid payload_size=" << frame_head.payload_size;
1012 return MakeH2Error(H2_FRAME_SIZE_ERROR);
1013 }
1014 const uint32_t inc = LoadUint32(it);
1015 if ((inc & 0x80000000) || (inc == 0)) {
1016 LOG(ERROR) << "Invalid window_size_increment=" << inc;
1017 return MakeH2Error(H2_PROTOCOL_ERROR);
1018 }
1019 if (frame_head.stream_id == 0) {
1020 if (!AddWindowSize(&_remote_window_left, inc)) {
1021 LOG(ERROR) << "Invalid connection-level window_size_increment=" << inc;
1022 return MakeH2Error(H2_FLOW_CONTROL_ERROR);
1023 }
1024 return MakeH2Message(NULL);
1025 } else {
1026 H2StreamContext* sctx = FindStream(frame_head.stream_id);
1027 if (sctx == NULL) {
1028 RPC_VLOG << "Fail to find stream_id=" << frame_head.stream_id;
1029 return MakeH2Message(NULL);
1030 }
1031 if (!AddWindowSize(&sctx->_remote_window_left, inc)) {
1032 LOG(ERROR) << "Invalid stream-level window_size_increment=" << inc
1033 << " to remote_window_left=" << sctx->_remote_window_left.load(butil::memory_order_relaxed);
1034 return MakeH2Error(H2_FLOW_CONTROL_ERROR);
1035 }
1036 return MakeH2Message(NULL);
1037 }
1038}
1039
1040void H2Context::Describe(std::ostream& os, const DescribeOptions& opt) const {
1041 if (opt.verbose) {

Callers

nothing calls this directly

Calls 5

MakeH2ErrorFunction · 0.85
LoadUint32Function · 0.85
AddWindowSizeFunction · 0.85
MakeH2MessageFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected