Commit fe97992a authored by Woo Xie's avatar Woo Xie Committed by Facebook Github Bot

catch the exception of getPeerAddress/getLocalAddress, separately

Summary: swap the order of getLocalAddress() and getPeerAddress(), so we are more likely to log the local address after exception happens.

Reviewed By: knekritz

Differential Revision: D15559814

fbshipit-source-id: 50b7a964d6c3add2e4ae1da9fde8e9e4e67e5715
parent 40e49acc
......@@ -2843,13 +2843,19 @@ std::string AsyncSocket::withAddr(const std::string& s) {
// e.g. if constructed from fd
folly::SocketAddress peer, local;
try {
getPeerAddress(&peer);
getLocalAddress(&local);
} catch (const std::exception&) {
// ignore
} catch (...) {
// ignore
}
try {
getPeerAddress(&peer);
} catch (const std::exception&) {
// ignore
} catch (...) {
// ignore
}
return s + " (peer=" + peer.describe() + ", local=" + local.describe() + ")";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment