MCPcopy Create free account
hub / github.com/acl-dev/acl / run_alone

Method run_alone

lib_acl_cpp/src/master/master_aio.cpp:81–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81bool master_aio::run_alone(const char* addrs, const char* path /* = NULL */,
82 aio_handle_type ht /* = ENGINE_SELECT */)
83{
84 acl_assert(__has_called == false);
85 __has_called = true;
86 daemon_mode_ = false;
87
88#ifdef ACL_WINDOWS
89 acl_cpp_init();
90#endif
91 std::vector<aio_listen_stream*> sstreams;
92 ACL_ARGV* tokens = acl_argv_split(addrs, ";,| \t");
93 ACL_ITER iter;
94
95 // ��ʼ�����ò���
96 conf_.load(path);
97
98 handle_ = NEW aio_handle(ht);
99
100 ACL_AIO* aio = handle_->get_handle();
101 acl_assert(aio);
102 ACL_EVENT* eventp = acl_aio_event(aio);
103 set_event(eventp); // ���û�����¼����
104
105 acl_foreach(iter, tokens) {
106 const char* addr = (const char*) iter.data;
107 aio_listen_stream* sstream = NEW aio_listen_stream(handle_);
108 // ����ָ���ĵ�ַ
109 if (!sstream->open(addr)) {
110 logger_error("listen %s error: %s", addr, last_serror());
111 close_all_listener(sstreams);
112 // XXX: Ϊ�˱�֤�ܹرռ�������Ӧ�ڴ˴��� check һ��
113 handle_->check();
114 acl_argv_free(tokens);
115 return (false);
116 }
117
118 service_on_listen(this, sstream->get_vstream());
119 sstream->add_accept_callback(this);
120 }
121 acl_argv_free(tokens);
122
123 service_pre_jail(this);
124 service_init(this);
125 while (true) {
126 // ������� false ���ʾ���ټ�������Ҫ�˳�
127 if (!handle_->check()) {
128 logger("aio_server stop now ...");
129 break;
130 }
131 }
132 close_all_listener(sstreams);
133 handle_->check();
134 service_pre_exit(this);
135 service_exit(this);
136 return true;
137}
138

Callers 15

mainFunction · 0.45
do_aloneFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
ssl_server.cppFile · 0.45
mainFunction · 0.45

Calls 11

acl_cpp_initFunction · 0.85
acl_argv_splitFunction · 0.85
acl_aio_eventFunction · 0.85
acl_argv_freeFunction · 0.85
close_all_listenerFunction · 0.70
aio_handleClass · 0.50
service_initFunction · 0.50
service_exitFunction · 0.50
loadMethod · 0.45
get_handleMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected