Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 while (tries > 0) { | 28 while (tries > 0) { |
| 29 ScopedFileHANDLE pipe( | 29 ScopedFileHANDLE pipe( |
| 30 CreateFile(pipe_name.c_str(), | 30 CreateFile(pipe_name.c_str(), |
| 31 GENERIC_READ | GENERIC_WRITE, | 31 GENERIC_READ | GENERIC_WRITE, |
| 32 0, | 32 0, |
| 33 nullptr, | 33 nullptr, |
| 34 OPEN_EXISTING, | 34 OPEN_EXISTING, |
| 35 SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, | 35 SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, |
| 36 nullptr)); | 36 nullptr)); |
| 37 if (!pipe.is_valid()) { | 37 if (!pipe.is_valid()) { |
| 38 Sleep(10); | 38 if (GetLastError() != ERROR_PIPE_BUSY) { |
| 39 PLOG(ERROR) << "CreateFile"; | |
| 40 return false; | |
| 41 } | |
| 42 | |
| 43 if (!WaitNamedPipe(pipe_name.c_str(), 1000)) { | |
|
Mark Mentovai
2015/11/06 23:03:34
We don’t want to do this at all on the last try.
scottmg
2015/11/06 23:10:59
Done.
| |
| 44 PLOG(ERROR) << "WaitNamedPipe"; | |
|
Mark Mentovai
2015/11/06 23:03:34
If GetLastError() is ERROR_SEM_TIMEOUT, we should
scottmg
2015/11/06 23:10:59
Done.
| |
| 45 return false; | |
| 46 } | |
| 39 --tries; | 47 --tries; |
| 40 continue; | 48 continue; |
| 41 } | 49 } |
| 42 DWORD mode = PIPE_READMODE_MESSAGE; | 50 DWORD mode = PIPE_READMODE_MESSAGE; |
| 43 if (!SetNamedPipeHandleState(pipe.get(), &mode, nullptr, nullptr)) { | 51 if (!SetNamedPipeHandleState(pipe.get(), &mode, nullptr, nullptr)) { |
| 44 PLOG(ERROR) << "SetNamedPipeHandleState"; | 52 PLOG(ERROR) << "SetNamedPipeHandleState"; |
| 45 return false; | 53 return false; |
| 46 } | 54 } |
| 47 DWORD bytes_read = 0; | 55 DWORD bytes_read = 0; |
| 48 BOOL result = TransactNamedPipe( | 56 BOOL result = TransactNamedPipe( |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 63 return false; | 71 return false; |
| 64 } | 72 } |
| 65 return true; | 73 return true; |
| 66 } | 74 } |
| 67 | 75 |
| 68 LOG(ERROR) << "failed to connect after retrying"; | 76 LOG(ERROR) << "failed to connect after retrying"; |
| 69 return false; | 77 return false; |
| 70 } | 78 } |
| 71 | 79 |
| 72 } // namespace crashpad | 80 } // namespace crashpad |
| OLD | NEW |