[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3714 - in GNUnet/src: applications/advertising application
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3714 - in GNUnet/src: applications/advertising applications/identity applications/session applications/topology_default server util/boot util/error |
Date: |
Sat, 11 Nov 2006 23:32:31 -0800 (PST) |
Author: grothoff
Date: 2006-11-11 23:32:24 -0800 (Sat, 11 Nov 2006)
New Revision: 3714
Modified:
GNUnet/src/applications/advertising/advertising.c
GNUnet/src/applications/identity/hostkey.c
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/session/connect.c
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/server/connection.c
GNUnet/src/util/boot/startup.c
GNUnet/src/util/error/error.c
Log:
fixing connectivity problems
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2006-11-12 04:35:33 UTC
(rev 3713)
+++ GNUnet/src/applications/advertising/advertising.c 2006-11-12 07:32:24 UTC
(rev 3714)
@@ -140,13 +140,17 @@
/* first verify that it is actually a valid hello */
msg = (P2P_hello_MESSAGE* ) message;
- if (ntohs(msg->header.size) != P2P_hello_MESSAGE_size(msg))
+ if (ntohs(msg->header.size) != P2P_hello_MESSAGE_size(msg)) {
+ GE_BREAK(ectx, 0);
return SYSERR;
+ }
identity->getPeerIdentity(&msg->publicKey,
&foreignId);
- if (!equalsHashCode512(&msg->senderIdentity.hashPubKey,
- &foreignId.hashPubKey))
+ if (! equalsHashCode512(&msg->senderIdentity.hashPubKey,
+ &foreignId.hashPubKey)) {
+ GE_BREAK(ectx, 0);
return SYSERR; /* public key and host hash do not match */
+ }
if (SYSERR == verifySig(&msg->senderIdentity,
P2P_hello_MESSAGE_size(msg)
- sizeof(Signature)
@@ -155,27 +159,38 @@
&msg->signature,
&msg->publicKey)) {
EncName enc;
- IF_GELOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- hash2enc(&msg->senderIdentity.hashPubKey,
- &enc));
- GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- _("hello message from `%s' invalid (signature invalid). Dropping.\n"),
- (char*)&enc);
+ IF_GELOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ hash2enc(&msg->senderIdentity.hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ _("hello message from `%s' invalid (signature invalid).
Dropping.\n"),
+ (char*)&enc);
return SYSERR; /* message invalid */
}
if ((TIME_T)ntohl(msg->expirationTime) > TIME(NULL) + MAX_HELLO_EXPIRES) {
- GE_LOG(ectx, GE_WARNING | GE_BULK | GE_USER,
- _("hello message received invalid (expiration time over limit).
Dropping.\n"));
- return SYSERR;
+ GE_LOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ _("hello message received invalid (expiration time over limit).
Dropping.\n"));
+ return SYSERR;
}
- if (SYSERR == transport->verifyhello(msg))
+ if (SYSERR == transport->verifyhello(msg)) {
+#if DEBUG_ADVERTISING
+ GE_LOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ _("hello transport verification failed (%u).\n"),
+ ntohs(msg->protocol));
+#endif
return OK; /* not good, but do process rest of message */
+ }
if (stats != NULL)
stats->change(stat_hello_in, 1);
#if DEBUG_ADVERTISING
- GE_LOG(ectx, GE_INFO | GE_REQUEST | GE_USER,
- _("hello advertisement for protocol %d received.\n"),
- ntohs(msg->protocol));
+ GE_LOG(ectx,
+ GE_INFO | GE_REQUEST | GE_USER,
+ _("hello advertisement for protocol %d received.\n"),
+ ntohs(msg->protocol));
#endif
if (ntohs(msg->protocol) == NAT_PROTOCOL_NUMBER) {
/* We *can* not verify NAT. Ever. So all we
@@ -211,13 +226,13 @@
identity->addHost(msg);
FREE(copy);
return OK;
- } else {
+ }
#if DEBUG_ADVERTISING
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "advertised hello differs from prior knowledge,"
- " requireing ping-pong confirmation.\n");
-#endif
- }
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "advertised hello differs from prior knowledge,"
+ " requireing ping-pong confirmation.\n");
+#endif
FREE(copy);
}
@@ -239,15 +254,19 @@
if the NAT transport is loaded; for that,
a couple of lines above would need some minor
editing :-). */
+#if DEBUG_ADVERTISING
+ GE_LOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ "Private network, discarding unknown advertisements\n");
+#endif
return SYSERR;
}
now = get_time();
- if ( (now - lasthelloMsg) *
+ if ( ( (now - lasthelloMsg) / cronSECONDS) *
(os_network_monitor_get_limit(coreAPI->load_monitor,
- Download) /
- cronSECONDS / 100)
- < P2P_hello_MESSAGE_size(msg) ) {
+ Download))
+ < P2P_hello_MESSAGE_size(msg) * 100 ) {
/* do not use more than about 1% of the
available bandwidth to VERIFY hellos (by sending
our own with a PING). This does not affect
@@ -257,6 +276,15 @@
malicious peers can spam us with hellos, and
we don't want to follow that up with massive
hello-ing by ourselves. */
+#if DEBUG_ADVERTISING
+ GE_LOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ "Not enough resources to verify hello at this time (%u * %u < %u *
100)\n",
+ (unsigned int) ((now - lasthelloMsg) / cronSECONDS),
+ (unsigned int) os_network_monitor_get_limit(coreAPI->load_monitor,
+ Download),
+ (unsigned int) P2P_hello_MESSAGE_size(msg));
+#endif
return SYSERR;
}
lasthelloMsg = now;
Modified: GNUnet/src/applications/identity/hostkey.c
===================================================================
--- GNUnet/src/applications/identity/hostkey.c 2006-11-12 04:35:33 UTC (rev
3713)
+++ GNUnet/src/applications/identity/hostkey.c 2006-11-12 07:32:24 UTC (rev
3714)
@@ -62,10 +62,22 @@
int signData(const void * data,
unsigned short size,
Signature * result) {
- return sign(hostkey,
- size,
- data,
- result);
+ int ret;
+
+ ret = sign(hostkey,
+ size,
+ data,
+ result);
+#if EXTRA_CHECKS
+ if (ret == OK) {
+ GE_ASSERT(NULL,
+ OK == verifySig(data,
+ size,
+ result,
+ &publicKey));
+ }
+#endif
+ return ret;
}
/**
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2006-11-12 04:35:33 UTC (rev
3713)
+++ GNUnet/src/applications/identity/identity.c 2006-11-12 07:32:24 UTC (rev
3714)
@@ -151,7 +151,7 @@
* @return filename of the form DIRECTORY/HOSTID.PROTOCOL
*/
static char * getHostFileName(const PeerIdentity * id,
- const unsigned short protocol) {
+ unsigned short protocol) {
EncName fil;
char * fn;
size_t n;
@@ -454,7 +454,7 @@
* Delete a host from the list.
*/
static void delHostFromKnown(const PeerIdentity * identity,
- const unsigned short protocol) {
+ unsigned short protocol) {
HostEntry * entry;
char * fn;
int i;
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2006-11-12 04:35:33 UTC (rev
3713)
+++ GNUnet/src/applications/session/connect.c 2006-11-12 07:32:24 UTC (rev
3714)
@@ -37,7 +37,7 @@
#define hello_HELPER_TABLE_START_SIZE 64
-#define DEBUG_SESSION NO
+#define DEBUG_SESSION YES
#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
@@ -123,13 +123,15 @@
GE_ASSERT(ectx, hostId != NULL);
#if DEBUG_SESSION
- IF_GELOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- hash2enc(&hostId->hashPubKey,
- &enc));
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Received `%s' from `%s', marking session as up.\n",
- "PONG",
- &enc);
+ IF_GELOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ hash2enc(&hostId->hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Received `%s' from `%s', marking session as up.\n",
+ "PONG",
+ &enc);
#endif
GE_ASSERT(ectx, hostId != NULL);
if (stats != NULL)
@@ -147,11 +149,13 @@
*
* @param hostId the sender of the key
* @param sks the session key message
- * @return SYSERR if invalid, OK if valid
+ * @return SYSERR if invalid, OK if valid, NO if
+ * connections are disallowed
*/
static int verifySKS(const PeerIdentity * hostId,
P2P_setkey_MESSAGE * sks) {
char * limited;
+ EncName enc;
if ( (sks == NULL) ||
(hostId == NULL) ) {
@@ -161,48 +165,46 @@
/* check if we are allowed to accept connections
from that peer */
limited = NULL;
- if (0 == GC_get_configuration_value_string(coreAPI->cfg,
- "GNUNETD",
- "LIMIT-ALLOW",
- "",
- &limited)) {
- EncName enc;
-
- GE_ASSERT(ectx, limited != NULL);
+ GC_get_configuration_value_string(coreAPI->cfg,
+ "GNUNETD",
+ "LIMIT-ALLOW",
+ "",
+ &limited);
+ if (strlen(limited) > 0) {
hash2enc(&hostId->hashPubKey,
&enc);
if (NULL == strstr(limited,
(char*) &enc)) {
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
"Connection from peer `%s' was rejected.\n",
&enc);
#endif
FREE(limited);
- return SYSERR;
+ return NO;
}
}
FREE(limited);
limited = NULL;
- if (0 == GC_get_configuration_value_string(coreAPI->cfg,
- "GNUNETD",
- "LIMIT-DENY",
- "",
- &limited)) {
- EncName enc;
-
- GE_ASSERT(ectx, limited != NULL);
+ GC_get_configuration_value_string(coreAPI->cfg,
+ "GNUNETD",
+ "LIMIT-DENY",
+ "",
+ &limited);
+ if (strlen(limited) > 0) {
hash2enc(&hostId->hashPubKey,
&enc);
if (NULL != strstr(limited,
(char*) &enc)) {
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Connection from peer `%s' was rejected.\n",
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Connection from peer `%s' was rejected.\n",
+ &enc);
#endif
FREE(limited);
- return SYSERR;
+ return NO;
}
}
FREE(limited);
@@ -214,12 +216,14 @@
&sks->signature)) {
EncName enc;
- IF_GELOG(ectx, GE_INFO | GE_USER | GE_REQUEST,
- hash2enc(&hostId->hashPubKey,
- &enc));
- GE_LOG(ectx, GE_INFO | GE_USER | GE_REQUEST,
- _("Session key from peer `%s' could not be verified.\n"),
- &enc);
+ IF_GELOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST,
+ hash2enc(&hostId->hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST,
+ _("Session key from peer `%s' could not be verified.\n"),
+ &enc);
return SYSERR; /*reject!*/
}
return OK; /* ok */
@@ -254,8 +258,9 @@
YES);
/* create and encrypt sessionkey */
if (NULL == foreignHelo) {
- GE_LOG(ectx, GE_INFO | GE_USER | GE_REQUEST,
- _("Cannot encrypt sessionkey, other peer not known!\n"));
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST,
+ _("Cannot encrypt sessionkey, other peer not known!\n"));
return NULL; /* other host not known */
}
@@ -267,9 +272,10 @@
msg = MALLOC(size);
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Sending setkey %s with %u bytes of data (%s, %s).\n",
- printSKEY(sk),
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Sending setkey %s with %u bytes of data (%s, %s).\n",
+ printSKEY(sk),
size,
ping != NULL ? "ping":"",
pong != NULL ? "pong":"");
@@ -289,14 +295,17 @@
msg->header.size = htons(size);
msg->header.type = htons(P2P_PROTO_setkey);
msg->creationTime = htonl(created);
- GE_ASSERT(ectx, SYSERR !=
- identity->signData(msg,
- sizeof(P2P_setkey_MESSAGE)
- - sizeof(Signature),
- &msg->signature));
+ GE_ASSERT(ectx,
+ SYSERR !=
+ identity->signData(msg,
+ sizeof(P2P_setkey_MESSAGE)
+ - sizeof(Signature),
+ &msg->signature));
#if EXTRA_CHECKS
/* verify signature/SKS */
- GE_ASSERT(ectx, OK == verifySKS(coreAPI->myIdentity, msg));
+ GE_ASSERT(ectx,
+ SYSERR != verifySKS(coreAPI->myIdentity,
+ msg));
#endif
size = 0;
@@ -320,11 +329,12 @@
size += ntohs(pong->size);
}
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Encrypting %d bytes of PINGPONG with key %s and IV %u\n",
- size,
- printSKEY(sk),
- *(int*)&msg->signature);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Encrypting %d bytes of PINGPONG with key %s and IV %u\n",
+ size,
+ printSKEY(sk),
+ *(int*)&msg->signature);
#endif
GE_ASSERT(ectx, -1 != encryptBlock(pt,
size,
@@ -371,9 +381,10 @@
YES);
if (tsession == NULL) {
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Key exchange with `%s' failed: could not connect.\n",
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Key exchange with `%s' failed: could not connect.\n",
+ &enc);
#endif
return SYSERR; /* failed to connect */
}
@@ -400,9 +411,10 @@
age = TIME(NULL);
makeSessionkey(&sk);
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Created fresh sessionkey `%s'.\n",
- printSKEY(&sk));
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Created fresh sessionkey `%s'.\n",
+ printSKEY(&sk));
#endif
}
@@ -421,8 +433,9 @@
/* create hello */
helo = transport->createhello(ANY_PROTOCOL_NUMBER);
if (NULL == helo) {
- GE_LOG(ectx, GE_INFO | GE_USER | GE_REQUEST,
- "Could not create any hello advertisement. Not good.");
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST,
+ "Could not create any hello advertisement. Not good.");
}
size = ntohs(skey->header.size);
if (helo != NULL)
@@ -445,10 +458,11 @@
size += ntohs(skey->header.size);
FREE(skey);
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Sending session key `%s' to peer `%s'.\n",
- printSKEY(&sk),
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Sending session key `%s' to peer `%s'.\n",
+ printSKEY(&sk),
+ &enc);
#endif
if (stats != NULL)
stats->change(stat_skeySent, 1);
@@ -488,16 +502,18 @@
int pos;
char * plaintext;
EncName enc;
+ int ret;
hash2enc(&sender->hashPubKey,
&enc);
if ( (topology != NULL) &&
(topology->allowConnectionFrom(sender) == SYSERR) ) {
+#if DEBUG_SESSION
GE_LOG(ectx,
GE_DEBUG | GE_USER | GE_REQUEST,
- "Rejected session key from peer `%s'.\n",
+ "Topology rejected session key from peer `%s'.\n",
&enc);
-
+#endif
return SYSERR;
}
if (equalsHashCode512(&sender->hashPubKey,
@@ -519,13 +535,15 @@
return SYSERR;
}
sessionkeySigned = (P2P_setkey_MESSAGE *) msg;
- if (SYSERR == verifySKS(sender,
- sessionkeySigned)) {
- GE_LOG(ectx,
- GE_INFO | GE_USER | GE_REQUEST | GE_DEVELOPER,
- "Signature of session key from `%s' failed"
- " verification (discarded).\n",
- &enc);
+ ret = verifySKS(sender,
+ sessionkeySigned);
+ if (OK != ret) {
+ if (ret == SYSERR)
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST | GE_DEVELOPER,
+ "Signature of session key from `%s' failed"
+ " verification (discarded).\n",
+ &enc);
if (stats != NULL)
stats->change(stat_skeyRejected,
1);
@@ -590,17 +608,17 @@
printSKEY(&key),
*(int*)&sessionkeySigned->signature);
#endif
- GE_ASSERT(ectx, -1 !=
- decryptBlock
- (&key,
- &((char*)sessionkeySigned)[sizeof(P2P_setkey_MESSAGE)],
- size,
- (const INITVECTOR*) &sessionkeySigned->signature,
- plaintext));
+ GE_ASSERT(ectx,
+ -1 != decryptBlock(&key,
+
&((char*)sessionkeySigned)[sizeof(P2P_setkey_MESSAGE)],
+ size,
+ (const INITVECTOR*)
&sessionkeySigned->signature,
+ plaintext));
pos = 0;
/* find pings & pongs! */
while (pos + sizeof(MESSAGE_HEADER) < size) {
MESSAGE_HEADER * hdr;
+
hdr = (MESSAGE_HEADER*) &plaintext[pos];
if (htons(hdr->size) + pos > size) {
GE_LOG(ectx,
@@ -684,36 +702,39 @@
#if DEBUG_SESSION
EncName enc;
- IF_GELOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- hash2enc(&peer->hashPubKey,
- &enc));
+ IF_GELOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ hash2enc(&peer->hashPubKey,
+ &enc));
#endif
if ( (topology != NULL) &&
(topology->allowConnectionFrom(peer) == SYSERR) ) {
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Topology rejected connecting to `%s'.\n",
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Topology rejected connecting to `%s'.\n",
+ &enc);
#endif
return SYSERR;
}
if (coreAPI->queryBPMfromPeer(peer) != 0) {
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Connection to `%s' already up (have BPM limit)\n",
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Connection to `%s' already up (have BPM limit)\n",
+ &enc);
#endif
return YES; /* trivial case */
}
#if DEBUG_SESSION
- GE_LOG(ectx, GE_DEBUG | GE_USER | GE_REQUEST,
- "Trying to exchange key with `%s'.\n",
- &enc);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_USER | GE_REQUEST,
+ "Trying to exchange key with `%s'.\n",
+ &enc);
#endif
if (OK == exchangeKey(peer, NULL, NULL))
return NO;
- else
- return SYSERR;
+ return SYSERR;
}
/**
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2006-11-12 04:35:33 UTC
(rev 3713)
+++ GNUnet/src/applications/topology_default/topology.c 2006-11-12 07:32:24 UTC
(rev 3714)
@@ -161,6 +161,7 @@
static void scanForHosts(unsigned int index) {
IndexMatch indexMatch;
cron_t now;
+ EncName enc;
if (os_network_monitor_get_load(coreAPI->load_monitor,
Upload) > 100)
@@ -175,7 +176,7 @@
&indexMatch);
if (indexMatch.matchCount == 0) {
GE_LOG(coreAPI->ectx,
- GE_DEBUG | GE_REQUEST,
+ GE_DEBUG | GE_REQUEST | GE_DEVELOPER,
"No peers found for slot %u\n",
index);
return; /* no matching peers found! */
@@ -195,6 +196,14 @@
GE_BREAK(NULL, 0); /* should REALLY not happen */
return;
}
+ IF_GELOG(coreAPI->ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER | GE_DEVELOPER,
+ hash2enc(&indexMatch.match,
+ &enc));
+ GE_LOG(coreAPI->ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER | GE_DEVELOPER,
+ "Trying to connect to peer `%s'\n",
+ &enc);
coreAPI->unicast(&indexMatch.match,
NULL,
0,
@@ -273,7 +282,7 @@
if (weak_randomi(LIVE_SCAN_EFFECTIVENESS) != 0)
continue;
if ( (minint > coreAPI->isSlotUsed(i)) &&
- (! autoconnect) )
+ (NO == autoconnect) )
scanForHosts(i);
}
active = coreAPI->forAllConnectedNodes
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2006-11-12 04:35:33 UTC (rev 3713)
+++ GNUnet/src/server/connection.c 2006-11-12 07:32:24 UTC (rev 3714)
@@ -666,7 +666,8 @@
* @param available what is the maximum length available?
* @return the overall priority that was achieved
*/
-static unsigned int solveKnapsack(BufferEntry * be, unsigned int available) {
+static unsigned int solveKnapsack(BufferEntry * be,
+ unsigned int available) {
unsigned int i;
int j;
int max;
@@ -1173,10 +1174,16 @@
EncName enc;
hdr = (MESSAGE_HEADER *) entry->closure;
- IF_GELOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
hash2enc(&be->session.sender.hashPubKey, &enc));
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Core selected message of type %u and size %u for sending to peer
`%s'.\n",
- ntohs(hdr->type), ntohs(hdr->size), &enc);
+ IF_GELOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ hash2enc(&be->session.sender.hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Core selected message of type %u and size %u for sending to
peer `%s'.\n",
+ ntohs(hdr->type),
+ ntohs(hdr->size),
+ &enc);
}
#endif
}
@@ -1551,7 +1558,8 @@
* @param be on which connection to transmit
* @param se what to transmit (with meta-data)
*/
-static void appendToBuffer(BufferEntry * be, SendEntry * se) {
+static void appendToBuffer(BufferEntry * be,
+ SendEntry * se) {
#if DEBUG_CONNECTION
EncName enc;
#endif
@@ -1744,7 +1752,8 @@
* @param arg the second argument to the method
* @return the number of connected hosts
*/
-static int forAllConnectedHosts(BufferEntryCallback method, void *arg) {
+static int forAllConnectedHosts(BufferEntryCallback method,
+ void *arg) {
unsigned int i;
int count = 0;
BufferEntry *be;
@@ -1771,7 +1780,8 @@
* @param arg closure of type fENHWrap giving the function
* to call
*/
-static void fENHCallback(BufferEntry * be, void *arg) {
+static void fENHCallback(BufferEntry * be,
+ void *arg) {
fENHWrap *wrap;
wrap = (fENHWrap *) arg;
@@ -1789,7 +1799,9 @@
* @param len the length of the pre-build message
* @return OK (always successful)
*/
-static int copyCallback(void *buf, void *closure, unsigned short len) {
+static int copyCallback(void *buf,
+ void *closure,
+ unsigned short len) {
if(len > 0) {
memcpy(buf, closure, len);
FREE(closure);
@@ -2489,7 +2501,9 @@
}
stamp = ntohl(msg->timeStamp);
if(stamp + 1 * cronDAYS < TIME(NULL)) {
- GE_LOG(ectx, GE_INFO | GE_BULK | GE_USER, _("Message received more than
one day old. Dropped.\n"));
+ GE_LOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ _("Message received more than one day old. Dropped.\n"));
MUTEX_UNLOCK(lock);
return SYSERR;
}
Modified: GNUnet/src/util/boot/startup.c
===================================================================
--- GNUnet/src/util/boot/startup.c 2006-11-12 04:35:33 UTC (rev 3713)
+++ GNUnet/src/util/boot/startup.c 2006-11-12 07:32:24 UTC (rev 3714)
@@ -30,7 +30,7 @@
#include "gnunet_util_error_loggers.h"
#include "platform.h"
-#define DO_REQUEST NO
+#define DO_REQUEST YES
static GE_KIND
convertLogLevel(const char * level) {
Modified: GNUnet/src/util/error/error.c
===================================================================
--- GNUnet/src/util/error/error.c 2006-11-12 04:35:33 UTC (rev 3713)
+++ GNUnet/src/util/error/error.c 2006-11-12 07:32:24 UTC (rev 3714)
@@ -111,23 +111,19 @@
* @brief Get user confirmation (e.g. before the app shuts down and closes the
* error message
*/
-void GE_CONFIRM(struct GE_Context * ctx)
-{
- if (ctx == NULL)
- {
+void GE_CONFIRM(struct GE_Context * ctx) {
+ if (ctx == NULL) {
/* @TODO: we probably ought to get confirmations in all graphical
- environments */
+ environments */
#ifdef WINDOWS
/* Console open? */
- if (GetStdHandle(STD_ERROR_HANDLE) != NULL)
- {
+ if (GetStdHandle(STD_ERROR_HANDLE) != NULL) {
fprintf(stderr,
- _("\nPress any key to continue\n"));
+ _("\nPress any key to continue\n"));
getch();
}
#endif
- }
- else if (ctx->confirm)
+ } else if (ctx->confirm)
ctx->confirm(ctx->cls);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3714 - in GNUnet/src: applications/advertising applications/identity applications/session applications/topology_default server util/boot util/error,
grothoff <=