| 63 | } |
| 64 | |
| 65 | void DNSThread::DNSThreadProc |
| 66 | ( |
| 67 | Event* _exitEvent |
| 68 | ) |
| 69 | { |
| 70 | Log::Write(LogLevel_Info, "Starting DNSThread"); |
| 71 | while( true ) |
| 72 | { |
| 73 | // DNSThread has been initialized |
| 74 | const uint32 count = 2; |
| 75 | |
| 76 | Wait* waitObjects[count]; |
| 77 | |
| 78 | int32 timeout = Wait::Timeout_Infinite; |
| 79 | // timeout = 5000; |
| 80 | |
| 81 | |
| 82 | waitObjects[0] = _exitEvent; // Thread must exit. |
| 83 | waitObjects[1] = m_dnsRequestEvent; // DNS Request |
| 84 | // Wait for something to do |
| 85 | |
| 86 | int32 res = Wait::Multiple( waitObjects, count, timeout ); |
| 87 | |
| 88 | switch (res) { |
| 89 | case -1: /* timeout */ |
| 90 | Log::Write(LogLevel_Warning, "DNSThread Timeout..."); |
| 91 | break; |
| 92 | case 0: /* exitEvent */ |
| 93 | Log::Write(LogLevel_Info, "Stopping DNSThread"); |
| 94 | return; |
| 95 | case 1: /* dnsEvent */ |
| 96 | processResult(); |
| 97 | break; |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | bool DNSThread::sendRequest |
| 103 | ( |
no test coverage detected