Commit 1910b46d authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2916] clarified what would happen if write blocks, and then return from test.

it should be safe to continue as clarified in the comment, but it's probably
better to eliminate any possibility of hangup.
parent da5d0b9b
......@@ -154,7 +154,13 @@ LocalSocketTest::checkAsyncRead(size_t data_len) {
expected_data[i] = i & 0xff;
}
alarm(IO_TIMEOUT);
EXPECT_EQ(data_len, write(sock_pair_[1].get(), &expected_data[0],
// If write blocks, it will eventually fail due to signal interruption.
// Since io_service has been stopped already, run() would immediately
// return and test should complete (with failure). But to make very sure
// it never cause hangup we rather return from the test at the point of
// failure of write. In either case it signals a failure and need for
// a fix.
ASSERT_EQ(data_len, write(sock_pair_[1].get(), &expected_data[0],
data_len));
io_service_.run();
EXPECT_TRUE(callback_called);
......
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