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

Method run_alone

lib_acl_cpp/src/master/master_proc.cpp:89–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89bool master_proc::run_alone(const char* addrs, const char* path /* = NULL */,
90 int count /* = 1 */)
91{
92 // ÿ������ֻ����һ��ʵ��������
93 acl_assert(__has_called == false);
94 __has_called = true;
95 daemon_mode_ = false;
96 count_limit_ = count;
97 acl_assert(addrs && *addrs);
98
99#ifdef ACL_WINDOWS
100 acl_cpp_init();
101#endif
102 ACL_EVENT* eventp = acl_event_new_select(1, 0);
103 set_event(eventp); // ���û��෽�������¼�������
104
105 std::vector<ACL_VSTREAM*> sstreams;
106 ACL_ARGV* tokens = acl_argv_split(addrs, ";,| \t");
107 ACL_ITER iter;
108
109 acl_foreach(iter, tokens) {
110 const char* addr = (const char*) iter.data;
111 ACL_VSTREAM* sstream = acl_vstream_listen(addr, 128);
112 if (sstream == NULL) {
113 logger_error("listen %s error %s", addr, last_serror());
114 close_all_listener(sstreams);
115 acl_argv_free(tokens);
116 return false;
117 }
118
119 service_on_listen(this, sstream);
120 acl_event_enable_listen(eventp, sstream, 0,
121 listen_callback, this);
122 sstreams.push_back(sstream);
123 }
124 acl_argv_free(tokens);
125
126 // ��ʼ�����ò���
127 conf_.load(path);
128
129 service_pre_jail(this);
130 service_init(this);
131
132 while (!stop_) {
133 acl_event_loop(eventp);
134 }
135
136 close_all_listener(sstreams);
137 acl_event_free(eventp);
138 service_pre_exit(this);
139 service_exit(this);
140
141 return true;
142}
143
144//////////////////////////////////////////////////////////////////////////
145

Callers

nothing calls this directly

Calls 10

acl_cpp_initFunction · 0.85
acl_event_new_selectFunction · 0.85
acl_argv_splitFunction · 0.85
acl_argv_freeFunction · 0.85
acl_event_loopFunction · 0.85
acl_event_freeFunction · 0.85
close_all_listenerFunction · 0.70
service_initFunction · 0.50
service_exitFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected