Browse Source

[trac499] Change where client's asynchronous send is waited for

Previously the client sent a message asynchronously to the server and the
server synchronously received it.  Then the code waited for the client send
to complete.  However, this hangs under Solaris.  So now the wait occurs after
the asynchronous send but before the synchronous receive, which Solaris can
apparently cope with.
Stephen Morris 14 years ago
parent
commit
7c38ee8fab
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/lib/asiolink/tests/tcp_socket_unittest.cc

+ 4 - 3
src/lib/asiolink/tests/tcp_socket_unittest.cc

@@ -380,12 +380,13 @@ TEST(TCPSocket, SequenceTest) {
     client_cb.length() = 0;
     client.asyncSend(OUTBOUND_DATA, sizeof(OUTBOUND_DATA), &server_endpoint, client_cb);
 
+    // Wait for the client callback to complete. (Must do this first on
+    // Solaris: if we do the synchronous read first, the test hangs.)
+    service.run_one();
+
     // Synchronously read the data from the server.;
     serverRead(server_socket, server_cb);
 
-    // Wait for the client callback to complete.
-    service.run_one();
-
     // Check the client state
     EXPECT_EQ(TCPCallback::WRITE, client_cb.called());
     EXPECT_EQ(0, client_cb.getCode());