Skip to content

Commit

Permalink
Fix beast::asio failures on OS X.
Browse files Browse the repository at this point in the history
There are 38 unittest failures on OS X.  These changes address all of
them by adjusting which side of the socket (send or receive) gets
shut down.  In each case, the failure was 'Socket is not connected'.
I've interpreted that to mean that the other thread had already shut
down its side of the connection.
  • Loading branch information
HowardHinnant authored and vinniefalco committed Mar 4, 2014
1 parent adc4c85 commit 0957099
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void TestPeerLogicAsyncClient::on_read_final (error_code const& ec, std::size_t)
{
// on_shutdown will call finished ()
error_code ec;
on_shutdown (socket ().shutdown (Socket::shutdown_both, ec));
on_shutdown (socket ().shutdown (Socket::shutdown_send, ec));
}
}
else
Expand Down Expand Up @@ -137,7 +137,7 @@ void TestPeerLogicAsyncClient::on_shutdown (error_code const& ec)
{
if (socket ().needs_handshake ())
{
socket ().shutdown (Socket::shutdown_both, error ());
socket ().shutdown (Socket::shutdown_send, error ());
}

if (! error ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void TestPeerLogicAsyncServer::on_write (error_code const& ec, std::size_t bytes
// on_shutdown will call finished ()
// we need another instance of ec so we can call on_shutdown()
error_code ec;
on_shutdown (socket ().shutdown (Socket::shutdown_both, ec));
on_shutdown (socket ().shutdown (Socket::shutdown_receive, ec));
}
}

Expand All @@ -102,7 +102,7 @@ void TestPeerLogicAsyncServer::on_shutdown (error_code const& ec)
{
if (socket ().needs_handshake ())
{
socket ().shutdown (Socket::shutdown_both, error ());
socket ().shutdown (Socket::shutdown_receive, error ());
}

if (success (socket ().close (error ())))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ void TestPeerLogicSyncClient::on_connect ()
{
if (failure (socket ().shutdown (error ()), true))
return;
error () = error_code ();
}

if (failure (socket ().shutdown (Socket::shutdown_both, error ())))
if (failure (socket ().shutdown (Socket::shutdown_send, error ())))
return;

if (failure (socket ().close (error ())))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void TestPeerLogicSyncServer::on_connect ()
return;
}

if (failure (socket ().shutdown (Socket::shutdown_both, error ())))
if (failure (socket ().shutdown (Socket::shutdown_send, error ())))
return;

if (failure (socket ().close (error ())))
Expand Down

0 comments on commit 0957099

Please sign in to comment.