| 181 | } |
| 182 | |
| 183 | static void process_async_connection(lua_State *L, NetServerInfo *server, TcpSocket *socket) |
| 184 | { |
| 185 | // FIXME: 这里用全局变量暂存的方式,对于闭包处理得不好,如果callback函数里使用了非全局变量的upval,可能会出问题 |
| 186 | lua_getglobal(L, "net_async_handler"); |
| 187 | if(!lua_isfunction(L, -1)) |
| 188 | { |
| 189 | lua_pop(L, 1); |
| 190 | return; |
| 191 | } |
| 192 | lua_pushlightuserdata(L, socket); |
| 193 | lua_pcall(L, 1, 0, 0); |
| 194 | lua_pop(L, 2); |
| 195 | } |
| 196 | |
| 197 | static void handle_accept_async(lua_State *L, NetServerInfo *server, TcpSocket *socket, |
| 198 | const boost::system::error_code& error) |
no test coverage detected