Merge branch 'cmake-server-pipe-mode-fix' into release

This commit is contained in:
Brad King 2016-10-18 13:12:02 -04:00
commit 074999171c
1 changed files with 5 additions and 6 deletions

View File

@ -323,11 +323,10 @@ bool cmServerPipeConnection::DoSetup(std::string* errorMessage)
": " + uv_err_name(r); ": " + uv_err_name(r);
return false; return false;
} }
auto serverStream = reinterpret_cast<uv_stream_t*>(&this->ServerPipe); auto serverStream = reinterpret_cast<uv_stream_t*>(this->ServerPipe);
serverStream->data = this;
if ((r = uv_listen(serverStream, 1, on_new_connection)) != 0) { if ((r = uv_listen(serverStream, 1, on_new_connection)) != 0) {
*errorMessage = std::string("Internal Error with ") + this->PipeName + *errorMessage = std::string("Internal Error listening on ") +
": " + uv_err_name(r); this->PipeName + ": " + uv_err_name(r);
return false; return false;
} }
@ -340,7 +339,7 @@ void cmServerPipeConnection::TearDown()
uv_close(reinterpret_cast<uv_handle_t*>(this->ClientPipe), &on_pipe_close); uv_close(reinterpret_cast<uv_handle_t*>(this->ClientPipe), &on_pipe_close);
this->WriteStream->data = nullptr; this->WriteStream->data = nullptr;
} }
uv_close(reinterpret_cast<uv_handle_t*>(&this->ServerPipe), &on_pipe_close); uv_close(reinterpret_cast<uv_handle_t*>(this->ServerPipe), &on_pipe_close);
this->ClientPipe = nullptr; this->ClientPipe = nullptr;
this->ServerPipe = nullptr; this->ServerPipe = nullptr;
@ -364,7 +363,7 @@ void cmServerPipeConnection::Connect(uv_stream_t* server)
this->ClientPipe = new uv_pipe_t; this->ClientPipe = new uv_pipe_t;
uv_pipe_init(this->Loop(), this->ClientPipe, 0); uv_pipe_init(this->Loop(), this->ClientPipe, 0);
this->ClientPipe->data = this; this->ClientPipe->data = this;
auto client = reinterpret_cast<uv_stream_t*>(&this->ClientPipe); auto client = reinterpret_cast<uv_stream_t*>(this->ClientPipe);
if (uv_accept(server, client) != 0) { if (uv_accept(server, client) != 0) {
uv_close(reinterpret_cast<uv_handle_t*>(client), nullptr); uv_close(reinterpret_cast<uv_handle_t*>(client), nullptr);
return; return;