static void service_test(void) { const char *addr = "127.0.0.1:8885"; ACL_VSTREAM *sstream = acl_vstream_listen(addr, 32), *client; int ret; assert(sstream != NULL); acl_xinetd_params_int_table(NULL, var_conf_int_tab); acl_xinetd_params_str_table(NULL, var_conf_str_tab); acl_xinetd_params_bool_table(NULL, var_conf_bool_tab); printf("listen %s ok\n", addr); service_init(NULL); while (1) { client = acl_vstream_accept(sstream, NULL, 0); if (client == NULL) { printf("accept error: %s\n", acl_last_serror()); break; } while (1) { if (acl_readable(ACL_VSTREAM_SOCK(client)) == 0) continue; ret = service_main(client, NULL); if (ret < 0) { acl_vstream_close(client); break; } if (ret > 0) break; } } service_exit(NULL); acl_vstream_close(sstream); }
void master_conf::load_str() { if (!cfg_loaded_ || str_cfg_ == NULL) return; acl_xinetd_params_str_table(cfg_, str_cfg_); }