| 55 | } |
| 56 | |
| 57 | bool ODClientTest::connect(const std::string& host, const int port, uint32_t timeout, const std::string& outputReplayFilename) |
| 58 | { |
| 59 | if(!ODSocketClient::connect(host, port, timeout, outputReplayFilename)) |
| 60 | { |
| 61 | OD_LOG_INF("Couldn't connect to server right away. Sleeping a bit before retry"); |
| 62 | // Units tests are supposed to be launched in parallel with OD exe. If we fail, we retry after |
| 63 | // a small sleep 5 seconds to make sure the server had time to launch |
| 64 | sf::sleep(sf::milliseconds(5000)); |
| 65 | if(!ODSocketClient::connect(host, port, timeout, outputReplayFilename)) |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | // Send a hello request to start the conversation with the server |
| 70 | ODPacket packSend; |
| 71 | packSend << ClientNotificationType::hello |
| 72 | << std::string("OpenDungeons V ") + OD_VERSION_STR; |
| 73 | send(packSend); |
| 74 | |
| 75 | return true; |
| 76 | } |
| 77 | |
| 78 | void ODClientTest::disconnect(bool keepReplay) |
| 79 | { |
no outgoing calls
no test coverage detected