forked from cory/tildefriends
		
	Fixed some socket leaks.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3897 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -237,11 +237,6 @@ void _socket_close_internal(socket_t* socket) | ||||
| void _socket_finalizer(JSRuntime *runtime, JSValue value) | ||||
| { | ||||
| 	socket_t* socket = JS_GetOpaque(value, _classId); | ||||
| 	if (socket->_listening) | ||||
| 	{ | ||||
| 		printf("FINALIZING A LISTENING SOCKET!\n"); | ||||
| 		abort(); | ||||
| 	} | ||||
| 	socket->_object = JS_UNDEFINED; | ||||
| 	_socket_close_internal(socket); | ||||
| } | ||||
| @@ -582,7 +577,9 @@ JSValue _socket_accept(JSContext* context, JSValueConst this_val, int argc, JSVa | ||||
| JSValue _socket_close(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) | ||||
| { | ||||
| 	socket_t* socket = JS_GetOpaque(this_val, _classId); | ||||
| 	if (socket->_closePromise == -1) | ||||
| 	if (socket->_closePromise == -1 && | ||||
| 		socket->_socket.data && | ||||
| 		!uv_is_closing((uv_handle_t*)&socket->_socket)) | ||||
| 	{ | ||||
| 		JSValue result = tf_task_allocate_promise(socket->_task, &socket->_closePromise); | ||||
| 		_socket_close_internal(socket); | ||||
|   | ||||
| @@ -168,6 +168,7 @@ static void _util_timeoutCallback(uv_timer_t* handle) | ||||
| 		NULL); | ||||
| 	tf_util_report_error(context, result); | ||||
| 	JS_FreeValue(context, result); | ||||
| 	JS_FreeValue(context, timeout->_callback); | ||||
| 	tf_trace_end(tf_task_get_trace(timeout->_task)); | ||||
| 	tf_free(timeout); | ||||
| 	uv_close((uv_handle_t*)handle, _handle_closed); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user