[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1110 - GNUnet/src/applications/pingpong
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1110 - GNUnet/src/applications/pingpong |
Date: |
Tue, 28 Jun 2005 10:50:22 -0700 (PDT) |
Author: grothoff
Date: 2005-06-28 10:50:19 -0700 (Tue, 28 Jun 2005)
New Revision: 1110
Modified:
GNUnet/src/applications/pingpong/pingpong.c
Log:
track pingpong errors
Modified: GNUnet/src/applications/pingpong/pingpong.c
===================================================================
--- GNUnet/src/applications/pingpong/pingpong.c 2005-06-28 14:28:57 UTC (rev
1109)
+++ GNUnet/src/applications/pingpong/pingpong.c 2005-06-28 17:50:19 UTC (rev
1110)
@@ -183,6 +183,7 @@
int i;
PINGPONG_Message * pmsg;
PingPongEntry * entry;
+ int matched;
#if DEBUG_PINGPONG
EncName enc;
#endif
@@ -203,6 +204,7 @@
"Received PONG from '%s'.\n",
&enc);
#endif
+ matched = 0;
MUTEX_LOCK(pingPongLock);
for (i=0;i<MAX_PING_PONG;i++) {
entry = &pingPongs[i];
@@ -215,9 +217,23 @@
memset(entry,
0,
sizeof(PingPongEntry));
+ matched++;
}
}
MUTEX_UNLOCK(pingPongLock);
+#if DEBUG_PINGPONG
+ hash2enc(&sender->hashPubKey,
+ &enc);
+ LOG(LOG_DEBUG,
+ "Received PONG from '%s' matched %u peers.\n",
+ &enc,
+ matched);
+#endif
+ if (matched == 0) {
+ LOG(LOG_WARNING,
+ _("Could not match PONG against any PING. "
+ "Try increasing MAX_PING_PONG constant.\n"));
+ }
return OK;
}
@@ -230,6 +246,10 @@
int i;
PINGPONG_Message * pmsg;
PingPongEntry * entry;
+ int matched;
+#if DEBUG_PINGPONG
+ EncName enc;
+#endif
pmsg = (PINGPONG_Message *) msg;
if ( (ntohs(msg->size) != sizeof(PINGPONG_Message)) ||
@@ -240,6 +260,7 @@
"pong");
return SYSERR; /* bad pong */
}
+ matched = 0;
MUTEX_LOCK(pingPongLock);
for (i=0;i<MAX_PING_PONG;i++) {
entry = &pingPongs[i];
@@ -252,9 +273,23 @@
memset(entry,
0,
sizeof(PingPongEntry));
+ matched++;
}
}
MUTEX_UNLOCK(pingPongLock);
+#if DEBUG_PINGPONG
+ hash2enc(&sender->hashPubKey,
+ &enc);
+ LOG(LOG_DEBUG,
+ "Received PONG from '%s' matched %u peers.\n",
+ &enc,
+ matched);
+#endif
+ if (matched == 0) {
+ LOG(LOG_WARNING,
+ _("Could not match PONG against any PING. "
+ "Try increasing MAX_PING_PONG constant.\n"));
+ }
return OK;
}
@@ -292,6 +327,9 @@
j = i;
}
if (j == -1) { /* all send this second!? */
+ LOG(LOG_WARNING,
+ _("Cannot create PING, table full. "
+ "Try increasing MAX_PING_PONG.\n"));
MUTEX_UNLOCK(pingPongLock);
return NULL;
}
@@ -379,7 +417,8 @@
/**
* Initialize the pingpong module.
*/
-Pingpong_ServiceAPI * provide_module_pingpong(CoreAPIForApplication * capi) {
+Pingpong_ServiceAPI *
+provide_module_pingpong(CoreAPIForApplication * capi) {
static Pingpong_ServiceAPI ret;
coreAPI = capi;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1110 - GNUnet/src/applications/pingpong,
grothoff <=