forked from cory/tildefriends
Add missing statics, and remove the 'tildefriends check' command.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4838 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -164,7 +164,7 @@ typedef struct _socket_resolve_data_t {
|
||||
promiseid_t promise;
|
||||
} socket_resolve_data_t;
|
||||
|
||||
socket_t* _socket_create_internal(JSContext* context)
|
||||
static socket_t* _socket_create_internal(JSContext* context)
|
||||
{
|
||||
socket_t* socket = tf_malloc(sizeof(socket_t));
|
||||
memset(socket, 0, sizeof(*socket));
|
||||
@ -226,12 +226,12 @@ socket_t* _socket_create_internal(JSContext* context)
|
||||
return socket;
|
||||
}
|
||||
|
||||
JSValue _socket_create(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_create(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
return _socket_create_internal(context)->_object;
|
||||
}
|
||||
|
||||
void _socket_close_internal(socket_t* socket)
|
||||
static void _socket_close_internal(socket_t* socket)
|
||||
{
|
||||
_socket_set_handler(socket, &socket->_onRead, JS_UNDEFINED);
|
||||
_socket_set_handler(socket, &socket->_onError, JS_UNDEFINED);
|
||||
@ -271,14 +271,14 @@ void _socket_close_internal(socket_t* socket)
|
||||
}
|
||||
}
|
||||
|
||||
void _socket_finalizer(JSRuntime* runtime, JSValue value)
|
||||
static void _socket_finalizer(JSRuntime* runtime, JSValue value)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(value, _classId);
|
||||
socket->_object = JS_UNDEFINED;
|
||||
_socket_close_internal(socket);
|
||||
}
|
||||
|
||||
void _socket_reportError(socket_t* socket, const char* error)
|
||||
static void _socket_reportError(socket_t* socket, const char* error)
|
||||
{
|
||||
JSContext* context = tf_task_get_context(socket->_task);
|
||||
JSValue ref = JS_DupValue(context, socket->_object);
|
||||
@ -299,7 +299,7 @@ void _socket_reportError(socket_t* socket, const char* error)
|
||||
JS_FreeValue(context, ref);
|
||||
}
|
||||
|
||||
void _socket_reportTlsErrors(socket_t* socket)
|
||||
static void _socket_reportTlsErrors(socket_t* socket)
|
||||
{
|
||||
char buffer[4096];
|
||||
while (socket->_tls && tf_tls_session_get_error(socket->_tls, buffer, sizeof(buffer)))
|
||||
@ -308,7 +308,7 @@ void _socket_reportTlsErrors(socket_t* socket)
|
||||
}
|
||||
}
|
||||
|
||||
JSValue _socket_startTls(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_startTls(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
if (!socket->_tls)
|
||||
@ -359,7 +359,7 @@ JSValue _socket_startTls(JSContext* context, JSValueConst this_val, int argc, JS
|
||||
}
|
||||
}
|
||||
|
||||
JSValue _socket_stopTls(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_stopTls(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
if (socket->_tls)
|
||||
@ -375,7 +375,7 @@ JSValue _socket_stopTls(JSContext* context, JSValueConst this_val, int argc, JSV
|
||||
return JS_NULL;
|
||||
}
|
||||
|
||||
bool _socket_processSomeOutgoingTls(socket_t* socket, promiseid_t promise, uv_write_cb callback)
|
||||
static bool _socket_processSomeOutgoingTls(socket_t* socket, promiseid_t promise, uv_write_cb callback)
|
||||
{
|
||||
if (!socket->_socket.data)
|
||||
{
|
||||
@ -416,14 +416,14 @@ bool _socket_processSomeOutgoingTls(socket_t* socket, promiseid_t promise, uv_wr
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
void _socket_processOutgoingTls(socket_t* socket)
|
||||
static void _socket_processOutgoingTls(socket_t* socket)
|
||||
{
|
||||
while (_socket_processSomeOutgoingTls(socket, -1, _socket_onWrite))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
JSValue _socket_bind(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_bind(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
const char* node = JS_ToCString(tf_task_get_context(socket->_task), argv[0]);
|
||||
@ -450,7 +450,7 @@ JSValue _socket_bind(JSContext* context, JSValueConst this_val, int argc, JSValu
|
||||
return promise;
|
||||
}
|
||||
|
||||
void _socket_onResolvedForBind(uv_getaddrinfo_t* resolver, int status, struct addrinfo* result)
|
||||
static void _socket_onResolvedForBind(uv_getaddrinfo_t* resolver, int status, struct addrinfo* result)
|
||||
{
|
||||
socket_resolve_data_t* data = (socket_resolve_data_t*)resolver->data;
|
||||
if (status != 0)
|
||||
@ -486,7 +486,7 @@ void _socket_onResolvedForBind(uv_getaddrinfo_t* resolver, int status, struct ad
|
||||
tf_free(data);
|
||||
}
|
||||
|
||||
JSValue _socket_connect(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_connect(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
socket->_direction = kConnect;
|
||||
@ -520,7 +520,7 @@ JSValue _socket_connect(JSContext* context, JSValueConst this_val, int argc, JSV
|
||||
return promise;
|
||||
}
|
||||
|
||||
void _socket_onResolvedForConnect(uv_getaddrinfo_t* resolver, int status, struct addrinfo* result)
|
||||
static void _socket_onResolvedForConnect(uv_getaddrinfo_t* resolver, int status, struct addrinfo* result)
|
||||
{
|
||||
socket_resolve_data_t* data = resolver->data;
|
||||
if (status != 0)
|
||||
@ -549,7 +549,7 @@ void _socket_onResolvedForConnect(uv_getaddrinfo_t* resolver, int status, struct
|
||||
tf_free(data);
|
||||
}
|
||||
|
||||
void _socket_onConnect(uv_connect_t* request, int status)
|
||||
static void _socket_onConnect(uv_connect_t* request, int status)
|
||||
{
|
||||
promiseid_t promise = (intptr_t)request->data;
|
||||
if (promise != -1)
|
||||
@ -571,7 +571,7 @@ void _socket_onConnect(uv_connect_t* request, int status)
|
||||
tf_free(request);
|
||||
}
|
||||
|
||||
JSValue _socket_listen(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_listen(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
socket->_listening = true;
|
||||
@ -593,7 +593,7 @@ JSValue _socket_listen(JSContext* context, JSValueConst this_val, int argc, JSVa
|
||||
}
|
||||
}
|
||||
|
||||
void _socket_onNewConnection(uv_stream_t* server, int status)
|
||||
static void _socket_onNewConnection(uv_stream_t* server, int status)
|
||||
{
|
||||
socket_t* socket = server->data;
|
||||
JSContext* context = tf_task_get_context(socket->_task);
|
||||
@ -609,7 +609,7 @@ void _socket_onNewConnection(uv_stream_t* server, int status)
|
||||
JS_FreeValue(context, ref);
|
||||
}
|
||||
|
||||
JSValue _socket_accept(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_accept(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
|
||||
@ -639,7 +639,7 @@ JSValue _socket_accept(JSContext* context, JSValueConst this_val, int argc, JSVa
|
||||
return result;
|
||||
}
|
||||
|
||||
JSValue _socket_close(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_close(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
if (socket->_closePromise == -1 &&
|
||||
@ -653,7 +653,7 @@ JSValue _socket_close(JSContext* context, JSValueConst this_val, int argc, JSVal
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue _socket_shutdown(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_shutdown(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
promiseid_t promise = -1;
|
||||
@ -669,7 +669,7 @@ JSValue _socket_shutdown(JSContext* context, JSValueConst this_val, int argc, JS
|
||||
return result;
|
||||
}
|
||||
|
||||
void _socket_shutdownInternal(socket_t* socket, promiseid_t promise)
|
||||
static void _socket_shutdownInternal(socket_t* socket, promiseid_t promise)
|
||||
{
|
||||
uv_shutdown_t* request = tf_malloc(sizeof(uv_shutdown_t));
|
||||
memset(request, 0, sizeof(*request));
|
||||
@ -684,7 +684,7 @@ void _socket_shutdownInternal(socket_t* socket, promiseid_t promise)
|
||||
}
|
||||
}
|
||||
|
||||
void _socket_processTlsShutdown(socket_t* socket, promiseid_t promise)
|
||||
static void _socket_processTlsShutdown(socket_t* socket, promiseid_t promise)
|
||||
{
|
||||
if (!socket->_tls)
|
||||
{
|
||||
@ -700,7 +700,7 @@ void _socket_processTlsShutdown(socket_t* socket, promiseid_t promise)
|
||||
}
|
||||
}
|
||||
|
||||
void _socket_onTlsShutdown(uv_write_t* request, int status)
|
||||
static void _socket_onTlsShutdown(uv_write_t* request, int status)
|
||||
{
|
||||
socket_t* socket = request->handle->data;
|
||||
promiseid_t promise = (intptr_t)request->data;
|
||||
@ -708,14 +708,14 @@ void _socket_onTlsShutdown(uv_write_t* request, int status)
|
||||
tf_free(request);
|
||||
}
|
||||
|
||||
JSValue _socket_onError(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_onError(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
_socket_set_handler(socket, &socket->_onError, argv[0]);
|
||||
return JS_NULL;
|
||||
}
|
||||
|
||||
JSValue _socket_read(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_read(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
JSValue ref = JS_DupValue(context, socket->_object);
|
||||
@ -745,12 +745,12 @@ JSValue _socket_read(JSContext* context, JSValueConst this_val, int argc, JSValu
|
||||
return read_result;
|
||||
}
|
||||
|
||||
void _socket_allocateBuffer(uv_handle_t* handle, size_t suggestedSize, uv_buf_t* buf)
|
||||
static void _socket_allocateBuffer(uv_handle_t* handle, size_t suggestedSize, uv_buf_t* buf)
|
||||
{
|
||||
*buf = uv_buf_init(tf_malloc(suggestedSize), suggestedSize);
|
||||
}
|
||||
|
||||
void _socket_onRead(uv_stream_t* stream, ssize_t readSize, const uv_buf_t* buffer)
|
||||
static void _socket_onRead(uv_stream_t* stream, ssize_t readSize, const uv_buf_t* buffer)
|
||||
{
|
||||
socket_t* socket = stream->data;
|
||||
_socket_resetTimeout(socket);
|
||||
@ -849,7 +849,7 @@ void _socket_onRead(uv_stream_t* stream, ssize_t readSize, const uv_buf_t* buffe
|
||||
JS_FreeValue(context, ref);
|
||||
}
|
||||
|
||||
void _socket_notifyDataRead(socket_t* socket, const char* data, size_t length)
|
||||
static void _socket_notifyDataRead(socket_t* socket, const char* data, size_t length)
|
||||
{
|
||||
if (data && length > 0)
|
||||
{
|
||||
@ -870,7 +870,7 @@ void _socket_notifyDataRead(socket_t* socket, const char* data, size_t length)
|
||||
}
|
||||
}
|
||||
|
||||
int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(socket_t* socket, promiseid_t promise, const char*, size_t), JSValue value, int* outLength)
|
||||
static int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(socket_t* socket, promiseid_t promise, const char*, size_t), JSValue value, int* outLength)
|
||||
{
|
||||
int result = -1;
|
||||
size_t length;
|
||||
@ -910,7 +910,7 @@ int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(so
|
||||
return result;
|
||||
}
|
||||
|
||||
int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* data, size_t length)
|
||||
static int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* data, size_t length)
|
||||
{
|
||||
if (!socket->_socket.data)
|
||||
{
|
||||
@ -942,7 +942,7 @@ static int _socket_write_tls(socket_t* socket, promiseid_t promise, const char*
|
||||
return tf_tls_session_write_plain(socket->_tls, data, size);
|
||||
}
|
||||
|
||||
JSValue _socket_write(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_write(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
promiseid_t promise = -1;
|
||||
@ -989,7 +989,7 @@ JSValue _socket_write(JSContext* context, JSValueConst this_val, int argc, JSVal
|
||||
return write_result;
|
||||
}
|
||||
|
||||
void _socket_onWrite(uv_write_t* request, int status)
|
||||
static void _socket_onWrite(uv_write_t* request, int status)
|
||||
{
|
||||
socket_t* socket = request->handle->data;
|
||||
_socket_resumeTimeout(socket);
|
||||
@ -1014,7 +1014,7 @@ static void _socket_timeout(uv_timer_t* timer)
|
||||
_socket_close_internal(socket);
|
||||
}
|
||||
|
||||
JSValue _socket_setActivityTimeout(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_setActivityTimeout(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
int64_t timeout = 0;
|
||||
@ -1028,13 +1028,13 @@ JSValue _socket_setActivityTimeout(JSContext* context, JSValueConst this_val, in
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue _socket_isConnected(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_isConnected(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
return socket->_connected ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
|
||||
void _socket_onClose(uv_handle_t* handle)
|
||||
static void _socket_onClose(uv_handle_t* handle)
|
||||
{
|
||||
--_open_count;
|
||||
socket_t* socket = handle->data;
|
||||
@ -1056,7 +1056,7 @@ void _socket_onClose(uv_handle_t* handle)
|
||||
_socket_close_internal(socket);
|
||||
}
|
||||
|
||||
void _socket_onShutdown(uv_shutdown_t* request, int status)
|
||||
static void _socket_onShutdown(uv_shutdown_t* request, int status)
|
||||
{
|
||||
socket_t* socket = request->handle->data;
|
||||
_socket_resetTimeout(socket);
|
||||
@ -1074,7 +1074,7 @@ void _socket_onShutdown(uv_shutdown_t* request, int status)
|
||||
tf_free(request);
|
||||
}
|
||||
|
||||
JSValue _socket_getPeerName(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_getPeerName(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
struct sockaddr_in6 addr;
|
||||
@ -1100,7 +1100,7 @@ JSValue _socket_getPeerName(JSContext* context, JSValueConst this_val, int argc,
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue _socket_getPeerCertificate(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_getPeerCertificate(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
if (socket->_tls)
|
||||
@ -1115,13 +1115,13 @@ JSValue _socket_getPeerCertificate(JSContext* context, JSValueConst this_val, in
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue _socket_getNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_getNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
return JS_NewBool(context, socket->_noDelay);
|
||||
}
|
||||
|
||||
JSValue _socket_setNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _socket_setNoDelay(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
socket_t* socket = JS_GetOpaque(this_val, _classId);
|
||||
int result = JS_ToBool(context, argv[0]);
|
||||
@ -1130,7 +1130,7 @@ JSValue _socket_setNoDelay(JSContext* context, JSValueConst this_val, int argc,
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue _sockets_get(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
static JSValue _sockets_get(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
JSValue array = JS_NewArray(context);
|
||||
for (int i = 0; i < _sockets_count; i++)
|
||||
|
Reference in New Issue
Block a user