diff --git a/extension.cpp b/extension.cpp index fe603e4..7577c15 100644 --- a/extension.cpp +++ b/extension.cpp @@ -79,6 +79,7 @@ void AsyncSocket::OnHandleDestroy(HandleType_t type, void *object) { } if (ctx->socket != NULL) { + uv_close((uv_handle_t *) ctx->socket, NULL); free(ctx->socket); } @@ -337,6 +338,8 @@ void async_write(uv_async_t *handle) { uv_write_t req; uv_write(&req, data->ctx->connect_req->handle, &data->buf, 1, NULL); + uv_close((uv_handle_t *) &data->buf, NULL); + free(data->buf.base); free(data); } diff --git a/pawn/include/async_socket.inc b/pawn/include/async_socket.inc index c0cf938..53679e4 100644 --- a/pawn/include/async_socket.inc +++ b/pawn/include/async_socket.inc @@ -6,14 +6,14 @@ #endif #define _async_socket_included -typedef AsyncSocketConnectCallback = function void(Socket socket); +typedef AsyncSocketConnectCallback = function void(AsyncSocket socket); -typedef AsyncSocketErrorCallback = function void(Socket socket, int error, const char[] errorName); +typedef AsyncSocketErrorCallback = function void(AsyncSocket socket, int error, const char[] errorName); -typedef AsyncSocketDataCallback = function void(Socket socket, const char[] data, const int size); +typedef AsyncSocketDataCallback = function void(AsyncSocket socket, const char[] data, const int size); -methodmap Socket < Handle { - public native Socket(); +methodmap AsyncSocket < Handle { + public native AsyncSocket(); public native bool Connect(const char[] host, const int port);