X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fsilcd.c;h=5bee97205e76a9181cb0d2d1d2f0cdc64c1837bb;hb=1d2558fef038d7c846c477ab7f63985eab4790b7;hp=344ebc60ce6d125bb08f9532209fb9ba2664b4f4;hpb=6f749a031aa242a4e9473b8e121d6a2676ce1e0b;p=silc.git diff --git a/apps/silcd/silcd.c b/apps/silcd/silcd.c index 344ebc60..5bee9720 100644 --- a/apps/silcd/silcd.c +++ b/apps/silcd/silcd.c @@ -327,24 +327,27 @@ SILC_TASK_CALLBACK(dump_stats) fprintf(fdd, " primary router : %s\n", silcd->router->server_name ? silcd->router->server_name : ""); -#if 0 - /* Dump socket connections */ + /* Dump connections */ { - int i; SilcPacketStream s; - - fprintf(fdd, "\nDumping socket connections\n"); - for (i = 0; i < silcd->config->param.connections_max; i++) { - s = silcd->sockets[i]; - if (!s) - continue; - fprintf(fdd, " %d: host %s ip %s port %d type %d flags 0x%x\n", - s->sock, s->hostname ? s->hostname : "N/A", - s->ip ? s->ip : "N/A", s->port, s->type, - (unsigned int)s->flags); + SilcDList conns = silc_packet_engine_get_streams(silcd->packet_engine); + + fprintf(fdd, "\nDumping connections\n"); + silc_dlist_start(conns); + while ((s = silc_dlist_get(conns))) { + const char *hostname, *ip; + SilcUInt16 port; + SilcSocket sock; + SilcIDListData idata = silc_packet_get_context(s); + if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(s), + &sock, &hostname, &ip, &port)) + continue; + fprintf(fdd, " %d: host %s ip %s port %d type %d\n", + sock, hostname ? hostname : "N/A", + ip ? ip : "N/A", port, idata ? idata->conn_type : 0); } + silc_dlist_uninit(conns); } -#endif /* Dump lists */ {