MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / connect

Method connect

source/tests/mocks/ODClientTest.cpp:57–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57bool 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
78void ODClientTest::disconnect(bool keepReplay)
79{

Callers 4

BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected