From 8585c92b7d0744a1f1a39c872cf5096621161b6c Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 16 Aug 2018 14:21:56 +0800 Subject: *update --- src/lua/net/luaopen_net.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lua/net/luaopen_net.cpp') diff --git a/src/lua/net/luaopen_net.cpp b/src/lua/net/luaopen_net.cpp index 7ec9cc7..0fce20f 100644 --- a/src/lua/net/luaopen_net.cpp +++ b/src/lua/net/luaopen_net.cpp @@ -2,13 +2,13 @@ #include "libjin/jin.h" #include "../luaopen_types.h" #include "Buffer.h" -#include "Socket.h" namespace jin { namespace lua { using namespace jin::lua::net; + using namespace jin::net; static int l_initNetwork(lua_State* L) { @@ -47,8 +47,9 @@ namespace lua } } Socket* socket = new Socket(info); + Ref* ref = new Ref(socket); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_SOCKET, sizeof(Proxy)); - proxy->bind(socket, JIN_NETWORK_SOCKET); + proxy->bind(ref, JIN_NETWORK_SOCKET); return 1; } @@ -58,7 +59,8 @@ namespace lua int size = luax_checkinteger(L, 1); Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy)); net::Buffer* buffer = new net::Buffer(size); - proxy->bind(buffer, JIN_NETWORK_BUFFER); + Ref* ref = new Ref(buffer); + proxy->bind(ref, JIN_NETWORK_BUFFER); return 1; } -- cgit v1.1-26-g67d0