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

Method DeferWindowUpdate

src/brpc/policy/http2_rpc_protocol.cpp:1078–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1076}
1077
1078void H2Context::DeferWindowUpdate(int64_t size) {
1079 if (size <= 0) {
1080 return;
1081 }
1082 const int64_t acc = _deferred_window_update.fetch_add(size, butil::memory_order_relaxed) + size;
1083 if (acc >= local_settings().stream_window_size / 2) {
1084 // Rarely happen for small messages.
1085 const int64_t conn_wu = _deferred_window_update.exchange(0, butil::memory_order_relaxed);
1086 if (conn_wu > 0) {
1087 char winbuf[FRAME_HEAD_SIZE + 4];
1088 SerializeFrameHead(winbuf, 4, H2_FRAME_WINDOW_UPDATE, 0, 0);
1089 SaveUint32(winbuf + FRAME_HEAD_SIZE, conn_wu);
1090 if (WriteAck(_socket, winbuf, sizeof(winbuf)) != 0) {
1091 LOG(WARNING) << "Fail to send WINDOW_UPDATE";
1092 }
1093 }
1094 }
1095}
1096
1097#if defined(BRPC_PROFILE_H2)
1098bvar::Adder<int64_t> g_parse_time;

Callers

nothing calls this directly

Calls 5

SerializeFrameHeadFunction · 0.85
WriteAckFunction · 0.85
fetch_addMethod · 0.80
SaveUint32Function · 0.70
exchangeMethod · 0.45

Tested by

no test coverage detected