Index: src/plugin/AdblockPlusClient.cpp |
=================================================================== |
--- a/src/plugin/AdblockPlusClient.cpp |
+++ b/src/plugin/AdblockPlusClient.cpp |
@@ -39,48 +39,41 @@ namespace |
CloseHandle(processInformation.hThread); |
} |
std::auto_ptr<Communication::Pipe> OpenAdblockPlusEnginePipe() |
{ |
std::auto_ptr<Communication::Pipe> result; |
try |
{ |
- try |
+ result.reset(new Communication::Pipe(Communication::pipeName, |
+ Communication::Pipe::MODE_CONNECT)); |
+ } |
+ catch (Communication::PipeConnectionError e) |
+ { |
+ SpawnAdblockPlusEngine(); |
+ |
+ int timeout = 10000; |
+ const int step = 10; |
+ while (!result.get()) |
{ |
- result.reset(new Communication::Pipe(Communication::pipeName, |
- Communication::Pipe::MODE_CONNECT)); |
- } |
- catch (Communication::PipeConnectionError e) |
- { |
- SpawnAdblockPlusEngine(); |
- |
- int timeout = 10000; |
- const int step = 10; |
- while (!result.get()) |
+ try |
{ |
- try |
- { |
- result.reset(new Communication::Pipe(Communication::pipeName, |
- Communication::Pipe::MODE_CONNECT)); |
- } |
- catch (Communication::PipeConnectionError e) |
- { |
- Sleep(step); |
- timeout -= step; |
- if (timeout <= 0) |
- throw std::runtime_error("Unable to open Adblock Plus Engine pipe"); |
- } |
+ result.reset(new Communication::Pipe(Communication::pipeName, |
+ Communication::Pipe::MODE_CONNECT)); |
+ } |
+ catch (Communication::PipeConnectionError e) |
+ { |
+ Sleep(step); |
+ timeout -= step; |
+ if (timeout <= 0) |
+ throw std::runtime_error("Unable to open Adblock Plus Engine pipe"); |
} |
} |
} |
- catch(std::exception e) |
- { |
- DEBUG_GENERAL(e.what()); |
Wladimir Palant
2013/06/03 11:43:31
I had to remove the try..catch block here - if the
|
- } |
return result; |
} |
std::vector<std::string> ReadStrings(Communication::InputBuffer& message) |
{ |
int32_t count; |
message >> count; |