Cleanup and renaming the methodmap
This commit is contained in:
parent
3ff141c303
commit
291dcfe41c
@ -79,6 +79,7 @@ void AsyncSocket::OnHandleDestroy(HandleType_t type, void *object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->socket != NULL) {
|
if (ctx->socket != NULL) {
|
||||||
|
uv_close((uv_handle_t *) ctx->socket, NULL);
|
||||||
free(ctx->socket);
|
free(ctx->socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +338,8 @@ void async_write(uv_async_t *handle) {
|
|||||||
uv_write_t req;
|
uv_write_t req;
|
||||||
uv_write(&req, data->ctx->connect_req->handle, &data->buf, 1, NULL);
|
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->buf.base);
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _async_socket_included
|
#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 {
|
methodmap AsyncSocket < Handle {
|
||||||
public native Socket();
|
public native AsyncSocket();
|
||||||
|
|
||||||
public native bool Connect(const char[] host, const int port);
|
public native bool Connect(const char[] host, const int port);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user