diff --git a/lutin_enet-test-client-http.py b/lutin_enet-test-client-http.py index 1c79fba..7077e9a 100644 --- a/lutin_enet-test-client-http.py +++ b/lutin_enet-test-client-http.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-client-http.cpp' ]) diff --git a/lutin_enet-test-client-websocket.py b/lutin_enet-test-client-websocket.py index 8e40fe0..b5aa1bf 100644 --- a/lutin_enet-test-client-websocket.py +++ b/lutin_enet-test-client-websocket.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-client-websocket.cpp' ]) diff --git a/lutin_enet-test-client.py b/lutin_enet-test-client.py index df252fa..00370e3 100644 --- a/lutin_enet-test-client.py +++ b/lutin_enet-test-client.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-client.cpp' ]) diff --git a/lutin_enet-test-server-http.py b/lutin_enet-test-server-http.py index f4996c5..da5059c 100644 --- a/lutin_enet-test-server-http.py +++ b/lutin_enet-test-server-http.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-server-http.cpp' ]) diff --git a/lutin_enet-test-server-websocket.py b/lutin_enet-test-server-websocket.py index 0d0784a..89f3dd5 100644 --- a/lutin_enet-test-server-websocket.py +++ b/lutin_enet-test-server-websocket.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-server-websocket.cpp' ]) diff --git a/lutin_enet-test-server.py b/lutin_enet-test-server.py index fea730a..07a9738 100644 --- a/lutin_enet-test-server.py +++ b/lutin_enet-test-server.py @@ -26,8 +26,8 @@ def get_maintainer(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_export_path(tools.get_current_path(__file__)) - my_module.add_module_depend(['enet', 'gtest', 'test-debug']) + my_module.add_path(tools.get_current_path(__file__), export=True) + my_module.add_depend(['enet', 'gtest', 'test-debug']) my_module.add_src_file([ 'test/main-server.cpp' ]) diff --git a/lutin_enet.py b/lutin_enet.py index eb5e703..f5070e7 100644 --- a/lutin_enet.py +++ b/lutin_enet.py @@ -26,12 +26,12 @@ def get_version(): def create(target, module_name): my_module = module.Module(__file__, module_name, get_type()) - my_module.add_module_depend(['etk', 'ememory', 'algue']) + my_module.add_depend(['etk', 'ememory', 'algue']) my_module.add_src_file([ 'enet/debug.cpp' ]) my_module.add_path(tools.get_current_path(__file__)) - if target.name == "Windows": + if "Windows" in target.get_type(): return my_module my_module.add_src_file([ 'enet/Udp.cpp', diff --git a/test/main-client.cpp b/test/main-client.cpp index dd8c18f..336652f 100644 --- a/test/main-client.cpp +++ b/test/main-client.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -28,17 +29,15 @@ int main(int _argc, const char *_argv[]) { TEST_INFO("=================================="); #ifndef __TARGET_OS__Windows // client mode ... - enet::Tcp connection; - connection.setHostNane("127.0.0.1"); - connection.setPort(31235); - connection.setServer(false); + // connect on TCP server: + enet::Tcp connection = std::move(enet::connectTcpClient("127.0.0.1", 12345)); TEST_INFO("CLIENT connect ..."); - if (connection.link() == false) { + if (connection.getConnectionStatus() != enet::Tcp::status::link) { TEST_ERROR("can not link to the socket..."); return -1; } int32_t iii = 0; - while ( connection.getConnectionStatus() == enet::Tcp::statusLink + while ( connection.getConnectionStatus() == enet::Tcp::status::link && iii<10000) { char data[1024]; int32_t len = connection.read(data, 1024); @@ -51,7 +50,7 @@ int main(int _argc, const char *_argv[]) { } if (iii>=10000) { TEST_INFO("auto disconnected"); - } else if (connection.getConnectionStatus() != enet::Tcp::statusLink) { + } else if (connection.getConnectionStatus() != enet::Tcp::status::link) { TEST_INFO("server disconnected"); } else { TEST_INFO("ERROR disconnected"); diff --git a/test/main-server.cpp b/test/main-server.cpp index 2068314..75b87fa 100644 --- a/test/main-server.cpp +++ b/test/main-server.cpp @@ -41,7 +41,7 @@ int main(int _argc, const char *_argv[]) { interface.unlink(); int32_t iii = 0; - while (tcpConnection.isAlive() == true) { + while (tcpConnection.getConnectionStatus() == enet::Tcp::status::link) { int32_t len = tcpConnection.write("plop" + etk::to_string(iii)); TEST_INFO("write len=" << len); char data[1024]; @@ -53,7 +53,7 @@ int main(int _argc, const char *_argv[]) { } if (iii>=1000000) { TEST_INFO("auto disconnected"); - } else if (tcpConnection.isAlive() != true) { + } else if (tcpConnection.getConnectionStatus() != enet::Tcp::status::link) { TEST_INFO("server disconnected"); } else { TEST_INFO("ERROR disconnected");