add patches from upstream git;

- Added debug logs for updating stat.clients value
- Take stream reference correctly in packet error callback

from Brad (maintainer).
This commit is contained in:
sthen 2009-01-12 00:31:45 +00:00
parent 4ab94e2cbc
commit c2516de9c9
5 changed files with 178 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.49 2009/01/10 01:04:06 sthen Exp $
# $OpenBSD: Makefile,v 1.50 2009/01/12 00:31:45 sthen Exp $
COMMENT= Secure Internet Live Conferencing (SILC) server
DISTNAME= silc-server-1.1.15
PKGNAME= ${DISTNAME}p0
CATEGORIES= net
HOMEPAGE= http://www.silcnet.org/

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-apps_silcd_command_reply_c,v 1.1 2009/01/12 00:31:45 sthen Exp $
--- apps/silcd/command_reply.c.orig Fri Jan 9 22:23:02 2009
+++ apps/silcd/command_reply.c Fri Jan 9 22:23:38 2009
@@ -1242,6 +1242,8 @@ SILC_SERVER_CMD_REPLY_FUNC(stats)
SILC_STR_END);
}
+ SILC_LOG_DEBUG(("stat.clients = %d\n", server->stat.clients));
+
out:
SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_STATS);
err:

View File

@ -0,0 +1,48 @@
$OpenBSD: patch-apps_silcd_packet_receive_c,v 1.1 2009/01/12 00:31:45 sthen Exp $
--- apps/silcd/packet_receive.c.orig Fri Jan 9 22:23:46 2009
+++ apps/silcd/packet_receive.c Fri Jan 9 22:27:18 2009
@@ -326,6 +326,8 @@ static void silc_server_notify_process(SilcServer serv
tmp_len = 128;
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -1246,6 +1248,8 @@ static void silc_server_notify_process(SilcServer serv
}
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -1492,6 +1496,8 @@ static void silc_server_notify_process(SilcServer serv
}
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -2686,6 +2692,8 @@ static void silc_server_new_id_real(SilcServer server,
if (idata->conn_type == SILC_CONN_SERVER)
server->stat.cell_clients++;
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients + 1));
server->stat.clients++;
/* Check if anyone is watching this nickname */
@@ -3742,6 +3750,8 @@ void silc_server_resume_client(SilcServer server,
we decremented the count already during detach, thus we'd be undoing
that operation. */
detached_client->local_detached = FALSE;
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)

View File

@ -0,0 +1,86 @@
$OpenBSD: patch-apps_silcd_server_c,v 1.3 2009/01/12 00:31:45 sthen Exp $
--- apps/silcd/server.c.orig Fri Jan 9 22:27:45 2009
+++ apps/silcd/server.c Fri Jan 9 22:39:18 2009
@@ -228,8 +228,10 @@ SILC_TASK_CALLBACK(silc_server_packet_error_timeout)
SilcPacketStream stream = context;
SilcIDListData idata = silc_packet_get_context(stream);
- if (!idata)
+ if (!idata || !silc_packet_stream_is_valid(stream)) {
+ silc_packet_stream_unref(stream);
return;
+ }
if (server->router_conn && server->router_conn->sock == stream &&
!server->router && server->standalone) {
@@ -252,6 +254,9 @@ SILC_TASK_CALLBACK(silc_server_packet_error_timeout)
}
silc_server_close_connection(server, stream);
+
+ /* Release our stream reference */
+ silc_packet_stream_unref(stream);
}
/* Packet engine callback to indicate error */
@@ -268,7 +273,7 @@ static void silc_server_packet_error(SilcPacketEngine
const char *ip;
SilcUInt16 port;
- SILC_LOG_DEBUG(("Packet error, sock %p", stream));
+ SILC_LOG_DEBUG(("Packet error %d, sock %p", error, stream));
if (!idata || !sock)
return;
@@ -283,6 +288,9 @@ static void silc_server_packet_error(SilcPacketEngine
if (!silc_packet_stream_is_valid(stream))
return;
+ /* We must take reference of the stream */
+ silc_packet_stream_ref(stream);
+
/* In case we get here many times, register only one timeout */
silc_schedule_task_del_by_all(server->schedule, 0,
silc_server_packet_error_timeout, stream);
@@ -2345,6 +2353,8 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, S
entry->data.conn_type = SILC_CONN_CLIENT;
/* Statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients + 1));
server->stat.my_clients++;
server->stat.clients++;
server->stat.cell_clients++;
@@ -3090,7 +3100,8 @@ void silc_server_disconnect_remote(SilcServer server,
if (!sock)
return;
- SILC_LOG_DEBUG(("Disconnecting remote host, sock %p", sock));
+ SILC_LOG_DEBUG(("Disconnecting remote host, sock %p, status %d", sock,
+ status));
va_start(ap, status);
cp = va_arg(ap, char *);
@@ -3154,6 +3165,8 @@ void silc_server_free_client_data(SilcServer server,
/* Local detached clients aren't counted. */
if (!client->local_detached)
server->stat.my_clients--;
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -3215,11 +3228,13 @@ void silc_server_free_sock_user_data(SilcServer server
if (idata->sconn && idata->sconn->op) {
SILC_LOG_DEBUG(("Abort active protocol"));
silc_async_abort(idata->sconn->op, NULL, NULL);
+ idata->sconn->op = NULL;
}
if (idata->conn_type == SILC_CONN_UNKNOWN &&
((SilcUnknownEntry)idata)->op) {
SILC_LOG_DEBUG(("Abort active protocol"));
silc_async_abort(((SilcUnknownEntry)idata)->op, NULL, NULL);
+ ((SilcUnknownEntry)idata)->op = NULL;
}
}

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-apps_silcd_server_util_c,v 1.3 2009/01/12 00:31:45 sthen Exp $
--- apps/silcd/server_util.c.orig Fri Jan 9 22:30:28 2009
+++ apps/silcd/server_util.c Fri Jan 9 22:32:09 2009
@@ -205,6 +205,8 @@ SilcBool silc_server_remove_clients_by_server(SilcServ
}
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -269,6 +271,8 @@ SilcBool silc_server_remove_clients_by_server(SilcServ
}
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)
@@ -1562,6 +1566,8 @@ void silc_server_kill_client(SilcServer server,
}
} else {
/* Update statistics */
+ SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+ server->stat.clients - 1));
SILC_VERIFY(server->stat.clients > 0);
server->stat.clients--;
if (server->stat.cell_clients)