Fix of a race condition during Crash Generation Server startup

https://breakpad.appspot.com/445002/



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1031 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2012-09-07 18:01:26 +00:00
parent b6514a8133
commit d6a10e6fbb

View file

@ -217,7 +217,7 @@ bool CrashGenerationServer::Start() {
// Event to signal the client connection and pipe reads and writes. // Event to signal the client connection and pipe reads and writes.
overlapped_.hEvent = CreateEvent(NULL, // Security descriptor. overlapped_.hEvent = CreateEvent(NULL, // Security descriptor.
TRUE, // Manual reset. TRUE, // Manual reset.
FALSE, // Initially signaled. FALSE, // Initially nonsignaled.
NULL); // Name. NULL); // Name.
if (!overlapped_.hEvent) { if (!overlapped_.hEvent) {
return false; return false;
@ -247,10 +247,13 @@ bool CrashGenerationServer::Start() {
// Kick-start the state machine. This will initiate an asynchronous wait // Kick-start the state machine. This will initiate an asynchronous wait
// for client connections. // for client connections.
HandleInitialState(); if (!SetEvent(overlapped_.hEvent)) {
server_state_ = IPC_SERVER_STATE_ERROR;
return false;
}
// If we are in error state, it's because we failed to start listening. // If we are in error state, it's because we failed to start listening.
return server_state_ != IPC_SERVER_STATE_ERROR; return true;
} }
// If the server thread serving clients ever gets into the // If the server thread serving clients ever gets into the