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

Function main

lib_rpc/samples/http_rpc_server/http_rpc_server.cpp:102–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102int main(int argc, char* argv[])
103{
104 bool use_mempool = false;
105 char addr[64];
106 int ch;
107
108 snprintf(addr, sizeof(addr), "127.0.0.1:8888");
109
110 while ((ch = getopt(argc, argv, "hs:m")) > 0)
111 {
112 switch (ch)
113 {
114 case 'h':
115 usage(argv[0]);
116 return 0;
117 case 's':
118 snprintf(addr, sizeof(addr), "%s", optarg);
119 break;
120 case 'm':
121 use_mempool = true;
122 break;
123 default:
124 break;
125 }
126 }
127
128 // �ú����ĵ��ñ���������ʹ�� acl �ĺ���֮ǰ
129 if (use_mempool)
130 acl_mem_slice_init(8, 1024, 100000,
131 ACL_SLICE_FLAG_GC2 |
132 ACL_SLICE_FLAG_RTGC_OFF |
133 ACL_SLICE_FLAG_LP64_ALIGN);
134
135#ifdef WIN32
136 acl::acl_cpp_init();
137#endif
138
139 acl::server_socket server;
140 if (server.open(addr) == false)
141 {
142 printf("can't listen on %s\r\n", addr);
143 return 1;
144 }
145
146 printf("listen on: %s ok\r\n", addr);
147
148 while(true)
149 {
150 acl::socket_stream* conn = server.accept();
151 if (conn == NULL)
152 {
153 printf("accept error\r\n");
154 break;
155 }
156 handle_client(conn);
157 }
158 return 0;
159}

Callers

nothing calls this directly

Calls 7

acl_mem_slice_initFunction · 0.85
acl_cpp_initFunction · 0.85
usageFunction · 0.70
handle_clientFunction · 0.70
getoptFunction · 0.50
openMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…