aboutsummaryrefslogtreecommitdiff
path: root/src/lua/net/luaopen_net.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-16 14:21:56 +0800
committerchai <chaifix@163.com>2018-08-16 14:21:56 +0800
commit8585c92b7d0744a1f1a39c872cf5096621161b6c (patch)
tree6aa02138f39f7b11ab17c7399064353092b8df0c /src/lua/net/luaopen_net.cpp
parentbe9b27dbf550093b555ab3087c11b38c89ab9fd0 (diff)
*update
Diffstat (limited to 'src/lua/net/luaopen_net.cpp')
-rw-r--r--src/lua/net/luaopen_net.cpp8
1 files changed, 5 insertions, 3 deletions
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<Socket>* ref = new Ref<Socket>(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<Buffer>* ref = new Ref<Buffer>(buffer);
+ proxy->bind(ref, JIN_NETWORK_BUFFER);
return 1;
}