Chromium Code Reviews| Index: net/test/embedded_test_server/embedded_test_server.cc |
| diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc |
| index 75b46e22166e6fb8aaaccddaf74e46dd863f3072..a0243eef40a1186bd5555d4159050ea4bf147e77 100644 |
| --- a/net/test/embedded_test_server/embedded_test_server.cc |
| +++ b/net/test/embedded_test_server/embedded_test_server.cc |
| @@ -198,6 +198,24 @@ void EmbeddedTestServer::InitializeOnIOThread() { |
| void EmbeddedTestServer::ListenOnIOThread() { |
| DCHECK(io_thread_->message_loop_proxy()->BelongsToCurrentThread()); |
| DCHECK(Started()); |
| + |
| +#if !defined(OS_POSIX) |
| + // Releases the socket here so that we could rebind it and watch it on the |
| + // right IO thread below. An alternative is to simply call |
| + // StreamListenSocket::WatchSocket, which is protected at the moment. |
| + // This hack is only needed for non POSIX platforms, since on POSIX platforms |
| + // StreamListenSocket::Listen calls StreamListenSocket::WatchSocket inside the |
| + // function. |
| + listen_socket_.reset(); |
| + |
| + SocketDescriptor socket_descriptor = |
| + TCPListenSocket::CreateAndBind("127.0.0.1", port_); |
|
xiyuan
2014/08/11 22:00:41
Thank you for digging through the problem.
Maybe
oshima
2014/08/12 04:27:25
sounds good to me.
If this was broken, I'm curiou
guohui
2014/08/12 15:55:19
thanks xiyuan, missed that =)
i think it is becau
|
| + if (socket_descriptor == kInvalidSocket) |
| + return; |
| + |
| + listen_socket_.reset(new HttpListenSocket(socket_descriptor, this)); |
| +#endif |
| + |
| listen_socket_->Listen(); |
| } |