[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1184 - in GNUnet: . src/applications/identity src/transpor
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1184 - in GNUnet: . src/applications/identity src/transports |
Date: |
Fri, 1 Jul 2005 05:56:44 -0700 (PDT) |
Author: grothoff
Date: 2005-07-01 05:56:37 -0700 (Fri, 01 Jul 2005)
New Revision: 1184
Modified:
GNUnet/ChangeLog
GNUnet/src/applications/identity/identity.c
GNUnet/src/transports/http.c
GNUnet/src/transports/tcp.c
Log:
weak
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2005-07-01 11:29:33 UTC (rev 1183)
+++ GNUnet/ChangeLog 2005-07-01 12:56:37 UTC (rev 1184)
@@ -1,3 +1,10 @@
+Fri Jul 1 15:08:42 CEST 2005
+ Added statistics for transports and other connection-
+ related functions. Prevented core from dropping
+ messages just because transport is (temporarily)
+ blocked. Made transport selection in identity random
+ again where necessary.
+
Thu Jun 30 20:05:15 CEST 2005
Added cache for KBlocks (can speed up insertion speed
for recursive inserts quite a bit).
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2005-07-01 11:29:33 UTC (rev
1183)
+++ GNUnet/src/applications/identity/identity.c 2005-07-01 12:56:37 UTC (rev
1184)
@@ -577,7 +577,7 @@
}
if (protocol == ANY_PROTOCOL_NUMBER)
- protocol = host->protocols[randomi(host->protocolCount)];
+ protocol = host->protocols[weak_randomi(host->protocolCount)];
for (i=0;i<host->heloCount;i++) {
if (host->helos[i]->protocol == protocol) {
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2005-07-01 11:29:33 UTC (rev 1183)
+++ GNUnet/src/transports/http.c 2005-07-01 12:56:37 UTC (rev 1184)
@@ -54,6 +54,7 @@
#include "gnunet_util.h"
#include "gnunet_protocols.h"
#include "gnunet_transport.h"
+#include "gnunet_stats_service.h"
#include "platform.h"
#include "ip.h"
@@ -214,6 +215,15 @@
static CoreAPIForTransport * coreAPI;
static TransportAPI httpAPI;
+static Stats_ServiceAPI * stats;
+
+static int stat_bytesReceived;
+
+static int stat_bytesSent;
+
+static int stat_bytesDropped;
+
+
/**
* one thread for listening for new connections,
* and for reading on all open sockets
@@ -519,6 +529,10 @@
ret = READ(httpSession->sock,
&httpSession->httpReadBuff[httpSession->httpRPos],
httpSession->httpRSize - httpSession->httpRPos);
+ if ( (ret > 0) &&
+ (stats != NULL) )
+ stats->change(stat_bytesReceived,
+ ret);
if (ret > 0) {
httpSession->httpRPos += ret;
incrementBytesReceived(ret);
@@ -537,6 +551,10 @@
ret = READ(httpSession->sock,
&httpSession->rbuff[httpSession->rpos],
httpSession->rsize - httpSession->rpos);
+ if ( (ret > 0) &&
+ (stats != NULL) )
+ stats->change(stat_bytesReceived,
+ ret);
if (ret > 0) {
httpSession->rpos += ret;
incrementBytesReceived(ret);
@@ -856,7 +874,11 @@
gnunet_util_sleep(20);
goto try_again_1;
}
+ if (stats != NULL)
+ stats->change(stat_bytesSent,
+ ret);
+
if (ret == 0) {
/* send only returns 0 on error (other side closed connection),
* so close the session */
@@ -1000,6 +1022,9 @@
}
if (success == NO)
ret = 0;
+ if (stats != NULL)
+ stats->change(stat_bytesSent,
+ ret);
if (ret > 0) {
if (ret < len) {
memmove(httpSession->wbuff,
@@ -1225,12 +1250,21 @@
return SYSERR;
}
- if (((HTTPSession*)tsession->internal)->sock == -1)
+ if (((HTTPSession*)tsession->internal)->sock == -1) {
+ if (stats != NULL)
+ stats->change(stat_bytesDropped,
+ ssize);
return SYSERR; /* other side closed connection */
+ }
ok = httpDirectSend(tsession->internal,
NO,
msg,
size);
+ if (ok != OK) {
+ if (stats != NULL)
+ stats->change(stat_bytesDropped,
+ ssize);
+ }
return ok;
}
@@ -1434,6 +1468,15 @@
} else {
theProxy.sin_addr.s_addr = 0;
}
+ stats = coreAPI->requestService("stats");
+ if (stats != NULL) {
+ stat_bytesReceived
+ = stats->create(_("# bytes received via HTTP"));
+ stat_bytesSent
+ = stats->create(_("# bytes sent via HTTP"));
+ stat_bytesDropped
+ = stats->create(_("# bytes dropped by HTTP (outgoing)"));
+ }
httpAPI.protocolNumber = HTTP_PROTOCOL_NUMBER;
httpAPI.mtu = 0;
@@ -1455,6 +1498,9 @@
void donetransport_http() {
int i;
+
+ coreAPI->releaseService(stats);
+ stats = NULL;
for (i=tsessionCount-1;i>=0;i--)
destroySession(i);
GROW(tsessions,
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-07-01 11:29:33 UTC (rev 1183)
+++ GNUnet/src/transports/tcp.c 2005-07-01 12:56:37 UTC (rev 1184)
@@ -1440,7 +1440,9 @@
void donetransport_tcp() {
int i;
+
coreAPI->releaseService(stats);
+ stats = NULL;
for (i=tsessionCount-1;i>=0;i--)
destroySession(i);
GROW(tsessions,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1184 - in GNUnet: . src/applications/identity src/transports,
grothoff <=