[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5251 - in GNUnet/src: applications/topology_default applic
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5251 - in GNUnet/src: applications/topology_default applications/topology_f2f server transports |
Date: |
Fri, 6 Jul 2007 22:44:37 -0600 (MDT) |
Author: grothoff
Date: 2007-07-06 22:44:36 -0600 (Fri, 06 Jul 2007)
New Revision: 5251
Modified:
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/applications/topology_f2f/topology.c
GNUnet/src/server/connection.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/udp.c
Log:
eliminate useless logging
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2007-07-06 18:31:07 UTC
(rev 5250)
+++ GNUnet/src/applications/topology_default/topology.c 2007-07-07 04:44:36 UTC
(rev 5251)
@@ -322,9 +322,9 @@
int autoconnect;
autoconnect = GC_get_configuration_value_yesno(coreAPI->cfg,
- "GNUNETD",
- "DISABLE-AUTOCONNECT",
- NO);
+ "GNUNETD",
+ "DISABLE-AUTOCONNECT",
+ NO);
slotCount = coreAPI->getSlotCount();
if ( (NO == autoconnect) &&
(saturation < 1) ) {
@@ -334,9 +334,9 @@
minint = MAX_PEERS_PER_SLOT; /* never put more than 10 peers into a slot
*/
for (i=slotCount-1;i>=0;i--) {
if (weak_randomi(LIVE_SCAN_EFFECTIVENESS) != 0)
- continue;
+ continue;
if (minint > coreAPI->isSlotUsed(i))
- scanForHosts(i);
+ scanForHosts(i);
}
}
active = coreAPI->forAllConnectedNodes(&checkNeedForPing,
@@ -444,30 +444,14 @@
return OK;
}
-#define TOPOLOGY_TAG_FILE "topology-070"
-
/**
* Update topology module.
*/
void update_module_topology_default(UpdateAPI * uapi) {
- State_ServiceAPI * state;
-
uapi->updateModule("state");
uapi->updateModule("identity");
uapi->updateModule("transport");
uapi->updateModule("pingpong");
-
- /* remove version stamp file from 0.7.0x,
- we have a global check for version, so
- we do not need this one anymore;
- this code can be removed in a few
- versions (since it is just minor cleanup
- anyway) */
- state = uapi->requestService("state");
- state->unlink(NULL,
- TOPOLOGY_TAG_FILE);
- uapi->releaseService(state);
- state = NULL;
}
static CoreAPIForApplication * myCapi;
Modified: GNUnet/src/applications/topology_f2f/topology.c
===================================================================
--- GNUnet/src/applications/topology_f2f/topology.c 2007-07-06 18:31:07 UTC
(rev 5250)
+++ GNUnet/src/applications/topology_f2f/topology.c 2007-07-07 04:44:36 UTC
(rev 5251)
@@ -124,9 +124,9 @@
* @param im updated structure used to select the peer
*/
static int scanHelperCount(const PeerIdentity * id,
- const unsigned short proto,
- int confirmed,
- void * cls) {
+ unsigned short proto,
+ int confirmed,
+ void * cls) {
IndexMatch * im = cls;
if (0 == memcmp(coreAPI->myIdentity,
@@ -135,6 +135,8 @@
return OK;
if (coreAPI->computeIndex(id) != im->index)
return OK;
+ if (OK == coreAPI->queryPeerStatus(id, NULL, NULL))
+ return OK;
if ( (YES == transport->isAvailable(proto)) &&
(OK == allowConnection(id)) ) {
im->matchCount++;
@@ -162,6 +164,8 @@
return OK;
if (coreAPI->computeIndex(id) != im->index)
return OK;
+ if (OK == coreAPI->queryPeerStatus(id, NULL, NULL))
+ return OK;
if ( (OK == allowConnection(id)) &&
(YES == transport->isAvailable(proto)) ) {
im->costSelector -= transport->getCost(proto);
@@ -185,7 +189,9 @@
static void scanForHosts(unsigned int index) {
IndexMatch indexMatch;
cron_t now;
+#if DEBUG_TOPOLOGY
EncName enc;
+#endif
now = get_time();
indexMatch.index = index;
@@ -213,19 +219,25 @@
GE_BREAK(ectx, 0); /* should REALLY not happen */
return;
}
- hash2enc(&indexMatch.match.hashPubKey,
- &enc);
+#if DEBUG_TOPOLOGY
+ IF_GELOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ hash2enc(&indexMatch.match.hashPubKey,
+ &enc));
GE_LOG(ectx,
- GE_DEBUG | GE_REQUEST | GE_USER,
- "Topology: trying to connect to `%s'.\n",
- &enc);
- coreAPI->unicast(&indexMatch.match,
- NULL,
- 0,
- 0);
- identity->blacklistHost(&indexMatch.match,
- (unsigned int) 5 * 60 * 60 * saturation, /* 5h at full
saturation */
- NO);
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Topology: trying to connect to `%s'.\n",
+ &enc);
+#endif
+ if (NO == identity->isBlacklistedStrict(&indexMatch.match)) {
+ coreAPI->unicast(&indexMatch.match,
+ NULL,
+ 0,
+ 0);
+ identity->blacklistHost(&indexMatch.match,
+ (unsigned int) 5 * 60 * 60 * saturation, /* 5h at
full saturation */
+ NO);
+ }
}
/**
@@ -276,9 +288,10 @@
#if DEBUG_TOPOLOGY
hash2enc(&hi->hashPubKey,
&enc);
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Sending ping to `%s' to prevent connection timeout.\n",
- (char*)&enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Sending ping to `%s' to prevent connection timeout.\n",
+ (char*)&enc);
#endif
if (OK != pingpong->ping(peer,
¬ifyPONG,
@@ -298,18 +311,24 @@
int i;
int slotCount;
int active;
+ int autoconnect;
+ autoconnect = GC_get_configuration_value_yesno(coreAPI->cfg,
+ "GNUNETD",
+ "DISABLE-AUTOCONNECT",
+ NO);
slotCount = coreAPI->getSlotCount();
- if (saturation < 1) {
+ if ( (NO == autoconnect) &&
+ (saturation < 1) ) {
for (i=slotCount-1;i>=0;i--) {
if (weak_randomi(LIVE_SCAN_EFFECTIVENESS) != 0)
- continue;
+ continue;
if (0 == coreAPI->isSlotUsed(i))
- scanForHosts(i);
+ scanForHosts(i);
}
}
active = coreAPI->forAllConnectedNodes(&checkNeedForPing,
- NULL);
+ NULL);
saturation = 1.0 * active / slotCount;
}
@@ -470,7 +489,18 @@
return OK;
}
+/**
+ * Update topology module.
+ */
+void update_module_topology_default(UpdateAPI * uapi) {
+ uapi->updateModule("state");
+ uapi->updateModule("identity");
+ uapi->updateModule("transport");
+ uapi->updateModule("pingpong");
+}
+
static CoreAPIForApplication * myCapi;
+
static Topology_ServiceAPI * myTopology;
int initialize_module_topology_f2f(CoreAPIForApplication * capi) {
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2007-07-06 18:31:07 UTC (rev 5250)
+++ GNUnet/src/server/connection.c 2007-07-07 04:44:36 UTC (rev 5251)
@@ -2584,12 +2584,15 @@
ENTRY();
GE_ASSERT(ectx, msg != NULL);
GE_ASSERT(ectx, sender != NULL);
- hash2enc(&sender->hashPubKey, &enc);
- if(size < sizeof(P2P_PACKET_HEADER)) {
+ if (size < sizeof(P2P_PACKET_HEADER)) {
+ IF_GELOG(ectx,
+ GE_WARNING | GE_BULK | GE_DEVELOPER,
+ hash2enc(&sender->hashPubKey,
+ &enc));
GE_LOG(ectx,
- GE_WARNING | GE_BULK | GE_DEVELOPER,
- _("Message from `%s' discarded: invalid format.\n"),
- &enc);
+ GE_WARNING | GE_BULK | GE_DEVELOPER,
+ _("Message from `%s' discarded: invalid format.\n"),
+ &enc);
return SYSERR;
}
if (stats != NULL)
@@ -2608,13 +2611,18 @@
MUTEX_LOCK(lock);
be = lookForHost(sender);
- if((be == NULL) ||
- (be->status == STAT_DOWN) || (be->status == STAT_SETKEY_SENT)) {
+ if ( (be == NULL) ||
+ (be->status == STAT_DOWN) ||
+ (be->status == STAT_SETKEY_SENT) ) {
#if DEBUG_CONNECTION
+ IF_GELOG(ectx,
+ GE_INFO | GE_BULK | GE_DEVELOPER,
+ hash2enc(&sender->hashPubKey,
+ &enc));
GE_LOG(ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
- "Decrypting message from host `%s' failed, no sessionkey (yet)!\n",
- &enc);
+ GE_INFO | GE_BULK | GE_DEVELOPER,
+ "Decrypting message from host `%s' failed, no sessionkey (yet)!\n",
+ &enc);
#endif
/* try to establish a connection, that way, we don't keep
getting bogus messages until the other one times out. */
@@ -2625,22 +2633,29 @@
}
tmp = MALLOC(size - sizeof(HashCode512));
res = decryptBlock(&be->skey_remote,
- &msg->sequenceNumber,
- size - sizeof(HashCode512),
- (const INITVECTOR *) &msg->hash, /* IV */
+ &msg->sequenceNumber,
+ size - sizeof(HashCode512),
+ (const INITVECTOR *) &msg->hash, /* IV */
tmp);
hash(tmp, size - sizeof(HashCode512), &hc);
- if(!((res != OK) && equalsHashCode512(&hc, &msg->hash))) {
+ if (! ( (res != OK) &&
+ equalsHashCode512(&hc, &msg->hash) ) ) {
+#if DEBUG_CONNECTION
+ IF_GELOG(ectx,
+ GE_INFO | GE_BULK | GE_DEVELOPER,
+ hash2enc(&sender->hashPubKey,
+ &enc));
GE_LOG(ectx,
- GE_INFO | GE_BULK | GE_DEVELOPER,
- "Decrypting message from host `%s' failed, wrong sessionkey!\n",
- &enc);
+ GE_INFO | GE_BULK | GE_DEVELOPER,
+ "Decrypting message from host `%s' failed, wrong sessionkey!\n",
+ &enc);
+#endif
addHost(sender, YES);
MUTEX_UNLOCK(lock);
FREE(tmp);
return SYSERR;
}
- if(stats != NULL)
+ if (stats != NULL)
stats->change(stat_decrypted, size - sizeof(HashCode512));
memcpy(&msg->sequenceNumber, tmp, size - sizeof(HashCode512));
FREE(tmp);
@@ -2658,26 +2673,30 @@
}
}
if (res == SYSERR) {
+#if DEBUG_CONNECTION
GE_LOG(ectx,
- GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
- _("Invalid sequence number"
- " %u <= %u, dropping message.\n"),
- sequenceNumber, be->lastSequenceNumberReceived);
+ GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
+ _("Invalid sequence number"
+ " %u <= %u, dropping message.\n"),
+ sequenceNumber,
+ be->lastSequenceNumberReceived);
+#endif
MUTEX_UNLOCK(lock);
return SYSERR;
}
- }
- else {
+ } else {
be->lastPacketsBitmap =
be->lastPacketsBitmap
<< (sequenceNumber - be->lastSequenceNumberReceived);
be->lastSequenceNumberReceived = sequenceNumber;
}
stamp = ntohl(msg->timeStamp);
- if(stamp + 1 * cronDAYS < TIME(NULL)) {
+ if (stamp + 1 * cronDAYS < TIME(NULL)) {
+#if DEBUG_CONNECTION
GE_LOG(ectx,
- GE_INFO | GE_BULK | GE_USER,
- _("Message received more than one day old. Dropped.\n"));
+ GE_INFO | GE_BULK | GE_USER,
+ _("Message received more than one day old. Dropped.\n"));
+#endif
MUTEX_UNLOCK(lock);
return SYSERR;
}
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-07-06 18:31:07 UTC (rev 5250)
+++ GNUnet/src/transports/tcp.c 2007-07-07 04:44:36 UTC (rev 5251)
@@ -261,8 +261,8 @@
once = 1;
#if DEBUG_TCP
GE_LOG(ectx,
- GE_DEBUG | GE_USER | GE_BULK,
- "TCP port is 0, will only send using TCP.\n");
+ GE_DEBUG | GE_USER | GE_BULK,
+ "TCP port is 0, will only send using TCP.\n");
#endif
}
return NULL; /* TCP transport is configured SEND-only! */
@@ -279,14 +279,14 @@
&haddr->ip)) ) ) {
FREE(msg);
GE_LOG(ectx,
- GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
- _("TCP: Could not determine my public IP address.\n"));
+ GE_WARNING | GE_ADMIN | GE_USER | GE_BULK,
+ _("TCP: Could not determine my public IP address.\n"));
return NULL;
}
GE_LOG(ectx,
- GE_INFO | GE_USER | GE_BULK,
- "TCP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*)&haddr->ip)));
+ GE_DEBUG | GE_USER | GE_BULK,
+ "TCP uses IP address %u.%u.%u.%u.\n",
+ PRIP(ntohl(*(int*)&haddr->ip)));
haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(HostAddress));
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2007-07-06 18:31:07 UTC (rev 5250)
+++ GNUnet/src/transports/tcp6.c 2007-07-07 04:44:36 UTC (rev 5251)
@@ -219,9 +219,11 @@
port = getGNUnetTCP6Port();
if (0 == port) {
+#if DEBUG_TCP6
GE_LOG(ectx,
- GE_DEBUG,
- "TCP6 port is 0, will only send using TCP6\n");
+ GE_DEBUG,
+ "TCP6 port is 0, will only send using TCP6\n");
+#endif
return NULL; /* TCP6 transport is configured SEND-only! */
}
msg = (P2P_hello_MESSAGE *) MALLOC(sizeof(P2P_hello_MESSAGE) +
sizeof(Host6Address));
@@ -232,8 +234,8 @@
&haddr->ip)) {
FREE(msg);
GE_LOG(ectx,
- GE_WARNING | GE_USER | GE_BULK,
- _("Could not determine my public IPv6 address.\n"));
+ GE_WARNING | GE_USER | GE_BULK,
+ _("Could not determine my public IPv6 address.\n"));
return NULL;
}
haddr->port = htons(port);
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-07-06 18:31:07 UTC (rev 5250)
+++ GNUnet/src/transports/udp.c 2007-07-07 04:44:36 UTC (rev 5251)
@@ -294,9 +294,9 @@
return NULL;
}
GE_LOG(ectx,
- GE_INFO | GE_USER | GE_BULK,
- "UDP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*)&haddr->ip)));
+ GE_DEBUG | GE_USER | GE_BULK,
+ "UDP uses IP address %u.%u.%u.%u.\n",
+ PRIP(ntohl(*(int*)&haddr->ip)));
haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(HostAddress));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5251 - in GNUnet/src: applications/topology_default applications/topology_f2f server transports,
gnunet <=