Commit d5f68ec9 authored by Amir Livneh's avatar Amir Livneh Committed by Facebook GitHub Bot

Don't include local IP in AsyncSocketException message for mobile builds

Reviewed By: yfeldblum

Differential Revision: D24739525

fbshipit-source-id: 1ad55b470dd305dea6f3c7eeb56890ea6b59d252
parent 9ca584be
......@@ -3037,8 +3037,11 @@ std::string AsyncSocket::withAddr(folly::StringPiece s) {
// ignore
}
return folly::to<std::string>(
s, " (peer=", peer.describe(), ", local=", local.describe(), ")");
return fmt::format(
"{} (peer={}{})",
s,
peer.describe(),
kIsMobile ? "" : fmt::format(", local={}", local.describe()));
}
void AsyncSocket::setBufferCallback(BufferCallback* cb) {
......
......@@ -1101,8 +1101,9 @@ TEST(AsyncSocketTest, WritePipeError) {
ASSERT_THAT(
wcb.exception.what(),
MatchesRegex(
"AsyncSocketException: writev\\(\\) failed \\(peer=.+, local=.+\\), "
"type = Internal error, errno = .+ \\(Broken pipe\\)"));
kIsMobile
? "AsyncSocketException: writev\\(\\) failed \\(peer=.+\\), type = Internal error, errno = .+ \\(Broken pipe\\)"
: "AsyncSocketException: writev\\(\\) failed \\(peer=.+, local=.+\\), type = Internal error, errno = .+ \\(Broken pipe\\)"));
ASSERT_FALSE(socket->isClosedBySelf());
ASSERT_FALSE(socket->isClosedByPeer());
}
......
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