提交 6ce3be29 编写于 作者: Y youngowlf

Make demos easier to use.

上级 753cd0a1
......@@ -50,7 +50,7 @@ using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define RECONNECT_COMMAND "reconnect"
#define RECONNECT "reconnect"
int main(int argc, const char* argv[])
{
......@@ -84,7 +84,7 @@ int main(int argc, const char* argv[])
sp.stop_service();
sp.start_service();
}
else if (RECONNECT_COMMAND == str)
else if (RECONNECT == str)
client.graceful_shutdown(true);
else
client.safe_send_msg(str, false);
......
......@@ -19,11 +19,11 @@ using namespace ascs::ext;
using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
class echo_socket : public client_socket
{
......
......@@ -18,11 +18,11 @@ using namespace ascs::tcp;
using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
class echo_socket : public server_socket
{
......@@ -68,7 +68,7 @@ int main(int argc, const char* argv[])
while(sp.is_running())
{
std::string str;
std::cin >> str;
std::getline(std::cin, str);
if (QUIT_COMMAND == str)
sp.stop_service();
else if (STATISTIC == str)
......
......@@ -60,11 +60,11 @@ using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
static bool check_msg;
......
......@@ -52,11 +52,11 @@ using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
//demonstrate how to use custom packer
//under the default behavior, each tcp::socket has their own packer, and cause memory waste
......@@ -195,7 +195,7 @@ int main(int argc, const char* argv[])
while(sp.is_running())
{
std::string str;
std::cin >> str;
std::getline(std::cin, str);
if (QUIT_COMMAND == str)
sp.stop_service();
else if (RESTART_COMMAND == str)
......
......@@ -16,10 +16,10 @@
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define REQUEST_FILE "get"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define REQUEST_FILE "get"
int link_num = 1;
fl_type file_size;
......
......@@ -25,9 +25,9 @@
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
int main(int argc, const char* argv[])
{
......
......@@ -24,11 +24,11 @@ using namespace ascs::ext::tcp;
#endif
#define QUIT_COMMAND "quit"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
cpu_timer begin_time;
std::atomic_ushort completed_session_num;
......
......@@ -24,11 +24,11 @@ using namespace ascs::tcp;
using namespace ascs::ext::tcp;
#define QUIT_COMMAND "quit"
#define LIST_ALL_CLIENT "list_all_client"
#define STATISTIC "statistic"
#define STATUS "status"
#define INCREASE_THREAD "increase_thread"
#define DECREASE_THREAD "decrease_thread"
#define STATISTIC "statistic"
#define LIST_ALL_CLIENT "list all client"
#define INCREASE_THREAD "increase thread"
#define DECREASE_THREAD "decrease thread"
class echo_socket : public server_socket
{
......@@ -74,7 +74,7 @@ int main(int argc, const char* argv[])
while(sp.is_running())
{
std::string str;
std::cin >> str;
std::getline(std::cin, str);
if (QUIT_COMMAND == str)
sp.stop_service();
else if (STATISTIC == str)
......
......@@ -22,7 +22,7 @@ using namespace ascs::ext::ssl;
#define QUIT_COMMAND "quit"
#define RESTART_COMMAND "restart"
#define RECONNECT_COMMAND "reconnect"
#define RECONNECT "reconnect"
#define SHOW_ALL_LINKS "show_all_links"
#define SHUTDOWN_LINK "shutdown"
......@@ -93,7 +93,7 @@ int main(int argc, const char* argv[])
client_.list_all_object();
}
#ifndef ASCS_REUSE_SSL_STREAM
else if (RESTART_COMMAND == str || RECONNECT_COMMAND == str)
else if (RESTART_COMMAND == str || RECONNECT == str)
puts("please define macro ASCS_REUSE_SSL_STREAM to test this feature.");
else if (SHUTDOWN_LINK == str)
// server_.at(0)->graceful_shutdown();
......@@ -115,7 +115,7 @@ int main(int argc, const char* argv[])
sp.start_service();
}
else if (RECONNECT_COMMAND == str)
else if (RECONNECT == str)
// server_.graceful_shutdown();
client_.graceful_shutdown(true);
else if (SHUTDOWN_LINK == str)
......
......@@ -375,6 +375,7 @@
*
* REFACTORING:
* Realigned member variables for ascs::socket to save a few memory.
* Make demos more easier to use.
*
* REPLACEMENTS:
*
......@@ -406,7 +407,7 @@
#endif
#define ASCS_SF "%zu" //format used to print 'size_t'
#if defined(__x86_64__) && !defined(__MINGW32__) && !defined(__MINGW64__)
#if defined(__x86_64__) && !defined(__MINGW64__) //terrible mingw
#define ASCS_LLF "%lu" //format used to print 'uint_fast64_t'
#endif
#else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册