1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

Add drain state to HQSession describe string

Summary:
This makes it much easier to understand session's state when going
through error messages

Reviewed By: mjoras

Differential Revision: D17126115

fbshipit-source-id: 2a90a3d56cf9db5f0ed576528d3257b414b73adb
This commit is contained in:
Yang Chi
2019-10-10 10:17:33 -07:00
committed by Facebook Github Bot
parent d0277b01ae
commit 80e85cb30f
2 changed files with 35 additions and 0 deletions

View File

@@ -3906,4 +3906,33 @@ std::ostream& operator<<(std::ostream& os, const HQSession& session) {
return os;
}
std::ostream& operator<<(std::ostream& os, HQSession::DrainState drainState) {
switch (drainState) {
case HQSession::DrainState::NONE:
os << "none";
break;
case HQSession::DrainState::PENDING:
os << "pending";
break;
case HQSession::DrainState::CLOSE_SENT:
os << "close_sent";
break;
case HQSession::DrainState::CLOSE_RECEIVED:
os << "close_recvd";
break;
case HQSession::DrainState::FIRST_GOAWAY:
os << "first_goaway";
break;
case HQSession::DrainState::SECOND_GOAWAY:
os << "second_goaway";
break;
case HQSession::DrainState::DONE:
os << "done";
break;
default:
folly::assume_unreachable();
}
return os;
}
} // namespace proxygen

View File

@@ -267,6 +267,7 @@ class HQSession
<< ", local=" << getLocalAddress() << ", " << getPeerAddress()
<< "=upstream";
}
os << ", drain=" << drainState_;
}
void onGoaway(uint64_t lastGoodStreamID,
@@ -2235,6 +2236,11 @@ class HQSession
// NOTE: introduce better decoupling between the streams
// and the containing session, then remove the friendship.
friend class HQStreamBase;
// To let the operator<< access DrainState which is private
friend std::ostream& operator<<(std::ostream&, DrainState);
}; // HQSession
std::ostream& operator<<(std::ostream& os, HQSession::DrainState drainState);
} // namespace proxygen