From 0cf41183301fd53250283e5163ae4ad4a83e52eb Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 23 May 2023 22:47:25 +0000 Subject: [PATCH] Remove Socket.info. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4312 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/socket.js.c | 18 ------------------ src/ssb.c | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/socket.js.c b/src/socket.js.c index 0c91e8d4..f11b132b 100644 --- a/src/socket.js.c +++ b/src/socket.js.c @@ -44,7 +44,6 @@ typedef struct _socket_t { JSValue _onConnect; JSValue _onRead; JSValue _onError; - JSValue _info; uint64_t created_ms; } socket_t; @@ -67,7 +66,6 @@ static JSValue _socket_getPeerName(JSContext* context, JSValueConst this_val, in static JSValue _socket_getPeerCertificate(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv); static JSValue _socket_getNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv); static JSValue _socket_setNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv); -static JSValue _socket_setInfo(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv); static JSValue _sockets_get(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv); static void _socket_onClose(uv_handle_t* handle); @@ -120,7 +118,6 @@ static void _socket_gc_mark(JSRuntime* runtime, JSValueConst value, JS_MarkFunc JS_MarkValue(runtime, socket->_onConnect, mark_func); JS_MarkValue(runtime, socket->_onRead, mark_func); JS_MarkValue(runtime, socket->_onError, mark_func); - JS_MarkValue(runtime, socket->_info, mark_func); } } @@ -211,11 +208,6 @@ socket_t* _socket_create_internal(JSContext* context) JS_DefinePropertyGetSet(context, object, atom, get_no_delay, set_no_delay, 0); JS_FreeAtom(context, atom); - atom = JS_NewAtom(context, "info"); - JSValue set_info = JS_NewCFunction(context, _socket_setInfo, "setInfo", 1); - JS_DefinePropertyGetSet(context, object, atom, JS_UNDEFINED, set_info, 0); - JS_FreeAtom(context, atom); - ++_open_count; uv_tcp_init(tf_task_get_loop(socket->_task), &socket->_socket); socket->_socket.data = socket; @@ -1094,15 +1086,6 @@ JSValue _socket_setNoDelay(JSContext* context, JSValueConst this_val, int argc, return JS_UNDEFINED; } -JSValue _socket_setInfo(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) -{ - socket_t* socket = JS_GetOpaque(this_val, _classId); - JSValue old = socket->_info; - socket->_info = JS_DupValue(context, argv[0]); - JS_FreeValue(context, old); - return JS_UNDEFINED; -} - JSValue _sockets_get(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv) { JSValue array = JS_NewArray(context); @@ -1115,7 +1098,6 @@ JSValue _sockets_get(JSContext* context, JSValueConst this_val, int argc, JSValu JS_SetPropertyStr(context, entry, "connected", JS_NewBool(context, s->_connected)); JS_SetPropertyStr(context, entry, "tls", JS_NewBool(context, s->_tls != NULL)); JS_SetPropertyStr(context, entry, "age_seconds", JS_NewFloat64(context, (uv_now(tf_task_get_loop(s->_task)) - s->created_ms) / 1000.0)); - JS_SetPropertyStr(context, entry, "info", JS_DupValue(context, s->_info)); JS_SetPropertyUint32(context, array, i, entry); } return array; diff --git a/src/ssb.c b/src/ssb.c index 24f38822..8d72a3bc 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -1755,7 +1755,7 @@ static void _tf_ssb_connection_dispatch_scheduled(tf_ssb_connection_t* connectio } } -void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason) +static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason) { tf_ssb_t* ssb = connection->ssb; if (!connection->destroy_reason)