OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 // This function must be called with service_context.pipe() already connected to | 390 // This function must be called with service_context.pipe() already connected to |
391 // a client pipe. It exchanges data with the client and adds a ClientData record | 391 // a client pipe. It exchanges data with the client and adds a ClientData record |
392 // to service_context->clients(). | 392 // to service_context->clients(). |
393 // | 393 // |
394 // static | 394 // static |
395 bool ExceptionHandlerServer::ServiceClientConnection( | 395 bool ExceptionHandlerServer::ServiceClientConnection( |
396 const internal::PipeServiceContext& service_context) { | 396 const internal::PipeServiceContext& service_context) { |
397 ClientToServerMessage message; | 397 ClientToServerMessage message; |
398 | 398 |
399 if (!LoggingReadFile(service_context.pipe(), &message, sizeof(message))) | 399 if (!LoggingReadFileExactly( |
| 400 service_context.pipe(), &message, sizeof(message))) |
400 return false; | 401 return false; |
401 | 402 |
402 switch (message.type) { | 403 switch (message.type) { |
403 case ClientToServerMessage::kShutdown: { | 404 case ClientToServerMessage::kShutdown: { |
404 if (message.shutdown.token != service_context.shutdown_token()) { | 405 if (message.shutdown.token != service_context.shutdown_token()) { |
405 LOG(ERROR) << "forged shutdown request, got: " | 406 LOG(ERROR) << "forged shutdown request, got: " |
406 << message.shutdown.token; | 407 << message.shutdown.token; |
407 return false; | 408 return false; |
408 } | 409 } |
409 ServerToClientMessage shutdown_response = {}; | 410 ServerToClientMessage shutdown_response = {}; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) { | 569 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) { |
569 // This function is executed on the thread pool. | 570 // This function is executed on the thread pool. |
570 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx); | 571 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx); |
571 base::AutoLock lock(*client->lock()); | 572 base::AutoLock lock(*client->lock()); |
572 | 573 |
573 // Post back to the main thread to have it delete this client record. | 574 // Post back to the main thread to have it delete this client record. |
574 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr); | 575 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr); |
575 } | 576 } |
576 | 577 |
577 } // namespace crashpad | 578 } // namespace crashpad |
OLD | NEW |