| 100 | } |
| 101 | |
| 102 | int 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…