[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1178 - in GNUnet: . m4 src/applications/advertising src/ap
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1178 - in GNUnet: . m4 src/applications/advertising src/applications/fs/tools src/applications/pingpong src/applications/transport src/include src/transports src/util |
Date: |
Thu, 30 Jun 2005 14:48:40 -0700 (PDT) |
Author: grothoff
Date: 2005-06-30 14:48:28 -0700 (Thu, 30 Jun 2005)
New Revision: 1178
Modified:
GNUnet/ChangeLog
GNUnet/m4/Makefile.in
GNUnet/src/applications/advertising/advertising.c
GNUnet/src/applications/fs/tools/gnunet-download.c
GNUnet/src/applications/pingpong/pingpong.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_transport_service.h
GNUnet/src/transports/udp.c
GNUnet/src/transports/udp6.c
GNUnet/src/util/generate
Log:
assertions
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2005-06-30 20:49:04 UTC (rev 1177)
+++ GNUnet/ChangeLog 2005-06-30 21:48:28 UTC (rev 1178)
@@ -1,3 +1,7 @@
+Thu Jun 30 20:05:15 CEST 2005
+ Added cache for KBlocks (can speed up insertion speed
+ for recursive inserts quite a bit).
+
Thu Jun 30 13:52:17 CEST 2005
Enabled IPv6 by default. Fixed various minor bugs.
Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in 2005-06-30 20:49:04 UTC (rev 1177)
+++ GNUnet/m4/Makefile.in 2005-06-30 21:48:28 UTC (rev 1178)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -33,6 +33,7 @@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+build_triplet = @build@
host_triplet = @host@
subdir = m4
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
@@ -183,6 +184,8 @@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -349,7 +352,7 @@
clean-generic:
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2005-06-30 20:49:04 UTC
(rev 1177)
+++ GNUnet/src/applications/advertising/advertising.c 2005-06-30 21:48:28 UTC
(rev 1178)
@@ -291,15 +291,22 @@
FREE(buffer);
LOG(LOG_INFO,
_("Could not send HELOs+PING, ping buffer full.\n"));
+ transport->disconnect(tsession);
+ return SYSERR;
}
- GNUNET_ASSERT(mtu > ntohs(ping->size));
- heloEnd = transport->getAdvertisedHELOs(mtu - ntohs(ping->size),
- buffer);
- GNUNET_ASSERT(mtu - ntohs(ping->size) > heloEnd);
- if (heloEnd == -1) {
+ if (mtu > ntohs(ping->size)) {
+ heloEnd = transport->getAdvertisedHELOs(mtu - ntohs(ping->size),
+ buffer);
+ GNUNET_ASSERT(mtu - ntohs(ping->size) >= heloEnd);
+ } else {
+ heloEnd = -2;
+ }
+ if (heloEnd <= 0) {
LOG(LOG_WARNING,
- "'%s' failed. Will not send PING.\n",
- "getAdvertisedHELOs");
+ _("'%s' failed (%d, %u). Will not send PING.\n"),
+ "getAdvertisedHELOs",
+ heloEnd,
+ mtu - ntohs(ping->size));
FREE(buffer);
transport->disconnect(tsession);
return SYSERR;
Modified: GNUnet/src/applications/fs/tools/gnunet-download.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-download.c 2005-06-30 20:49:04 UTC
(rev 1177)
+++ GNUnet/src/applications/fs/tools/gnunet-download.c 2005-06-30 21:48:28 UTC
(rev 1178)
@@ -156,7 +156,8 @@
if (YES == testConfigurationString("GNUNET-DOWNLOAD",
"VERBOSE",
"YES")) {
- PRINTF(_("Download of file '%s' at %16llu out of %16llu bytes (%8.3f
kbps)\n"),
+ PRINTF(_("Download of file '%s' at "
+ "%16llu out of %16llu bytes (%8.3f kbps)\n"),
event->data.DownloadProgress.filename,
event->data.DownloadProgress.completed,
event->data.DownloadProgress.total,
@@ -187,7 +188,8 @@
case FSUI_download_complete:
if ( (event->data.DownloadProgress.completed ==
event->data.DownloadProgress.total) ) {
- printf(_("Download of file '%s' complete. Speed was %8.3f kilobyte per
second.\n"),
+ printf(_("Download of file '%s' complete. "
+ "Speed was %8.3f kilobyte per second.\n"),
event->data.DownloadProgress.filename,
(event->data.DownloadProgress.completed/1024.0) /
(((double)(cronTime(NULL)-(event->data.DownloadProgress.start_time
- 1)))
@@ -198,7 +200,8 @@
SEMAPHORE_UP(signalFinished);
}
} else {
- PRINTF(_("Recursive download of directory '%s' at %llu of %llu
bytes.\n"),
+ PRINTF(_("Recursive download of directory '%s' at "
+ "%llu of %llu bytes.\n"),
event->data.DownloadProgress.filename,
event->data.DownloadProgress.completed,
event->data.DownloadProgress.total);
Modified: GNUnet/src/applications/pingpong/pingpong.c
===================================================================
--- GNUnet/src/applications/pingpong/pingpong.c 2005-06-30 20:49:04 UTC (rev
1177)
+++ GNUnet/src/applications/pingpong/pingpong.c 2005-06-30 21:48:28 UTC (rev
1178)
@@ -130,6 +130,8 @@
return SYSERR; /* not for us */
}
pmsg->header.type = htons(p2p_PROTO_PONG);
+ if (stats != NULL)
+ stats->change(stat_pingReceived, 1);
coreAPI->unicast(sender,
&pmsg->header,
0,
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2005-06-30 20:49:04 UTC
(rev 1177)
+++ GNUnet/src/applications/transport/transport.c 2005-06-30 21:48:28 UTC
(rev 1178)
@@ -38,8 +38,8 @@
static Identity_ServiceAPI * identity;
static TransportAPI ** tapis = NULL;
-static int tapis_count = 0;
-static int helo_live;
+static unsigned int tapis_count = 0;
+static unsigned int helo_live;
static Mutex tapis_lock;
@@ -56,6 +56,9 @@
tapi->helo = NULL;
if (SYSERR == tapi->createHELO(&tapi->helo)) {
tapi->helo = NULL;
+ LOG(LOG_DEBUG,
+ "Transport %s failed to create HELO\n",
+ tapi->transName);
MUTEX_UNLOCK(&tapis_lock);
return;
}
@@ -77,8 +80,9 @@
- sizeof(PublicKey)
- sizeof(p2p_HEADER),
&tapi->helo->signature)) {
- FREE(tapi->helo);
+ FREE(tapi->helo);
tapi->helo = NULL;
+ BREAK();
}
MUTEX_UNLOCK(&tapis_lock);
}
@@ -448,11 +452,9 @@
return SYSERR;
}
if (tapi->helo == NULL) {
-#if DEBUG_TRANSPORT
LOG(LOG_DEBUG,
- "Transport of type %d configured for sending only.\n",
+ "Transport of type %d configured for sending only (no HELO).\n",
ttype);
-#endif
MUTEX_UNLOCK(&tapis_lock);
return SYSERR;
}
@@ -478,14 +480,14 @@
* @param buff where to write the HELO messages
* @return the number of bytes written to buff, -1 on error
*/
-static int getAdvertisedHELOs(int maxLen,
+static int getAdvertisedHELOs(unsigned int maxLen,
char * buff) {
int i;
- int j;
int tcount;
HELO_Message ** helos;
int used;
+ MUTEX_LOCK(&tapis_lock);
tcount = 0;
for (i=0;i<tapis_count;i++)
if (tapis[i] != NULL)
@@ -495,38 +497,38 @@
tcount = 0;
for (i=0;i<tapis_count;i++)
if (tapis[i] != NULL)
- if (OK == transportCreateHELO(i, &helos[tcount]))
+ if (OK == transportCreateHELO(i,
+ &helos[tcount]))
tcount++;
- if (tcount == 0)
+ MUTEX_UNLOCK(&tapis_lock);
+ if (tcount == 0) {
+ LOG(LOG_DEBUG,
+ "%s failed: no transport succeeded in creating a HELO\n");
return SYSERR;
- j = 0;
+ }
used = 0;
- while (j < 10) {
- j++;
- i = randomi(tcount); /* select a HELO at random */
- if (helos[i] == NULL)
- continue; /* copied this one already */
- if ((int)HELO_Message_size(helos[i]) > maxLen - used)
- continue;
- memcpy(&buff[used],
- helos[i],
- HELO_Message_size(helos[i]));
- used += HELO_Message_size(helos[i]);
+ while (tcount > 0) {
+ i = weak_randomi(tcount); /* select a HELO at random */
+ if ((unsigned int)HELO_Message_size(helos[i]) <= maxLen - used) {
+ memcpy(&buff[used],
+ helos[i],
+ HELO_Message_size(helos[i]));
+ used += HELO_Message_size(helos[i]);
+ }
FREE(helos[i]);
- helos[i] = NULL;
- j = 0; /* try until 10 attempts fail, restart after every success! */
+ helos[i] = helos[--tcount];
}
-
for (i=0;i<tcount;i++)
- if (helos[i] != NULL)
- FREE(helos[i]);
+ FREE(helos[i]);
FREE(helos);
+ if (used == 0)
+ LOG(LOG_DEBUG,
+ "%s failed: no HELOs fit in %u bytes\n",
+ maxLen);
return used;
}
-
-
/**
* Actually start the transport services and begin
* receiving messages.
@@ -570,7 +572,8 @@
/**
* Initialize the transport layer.
*/
-Transport_ServiceAPI * provide_module_transport(CoreAPIForApplication * capi) {
+Transport_ServiceAPI *
+provide_module_transport(CoreAPIForApplication * capi) {
static Transport_ServiceAPI ret;
TransportAPI * tapi;
TransportMainMethod tptr;
@@ -600,21 +603,23 @@
if (helo_live <= 0) {
helo_live = 60 * 60;
LOG(LOG_WARNING,
- _("Option '%s' not set in configuration in section '%s', setting to
%dm.\n"),
+ _("Option '%s' not set in configuration in section '%s',"
+ " setting to %dm.\n"),
"HELOEXPIRES", "GNUNETD", helo_live / 60);
}
GROW(tapis,
tapis_count,
UDP_PROTOCOL_NUMBER+1);
- MUTEX_CREATE(&tapis_lock);
+ MUTEX_CREATE_RECURSIVE(&tapis_lock);
/* now load transports */
dso = getConfigurationString("GNUNETD",
"TRANSPORTS");
if (dso == NULL) {
- LOG(LOG_FAILURE,
- _("You should specify at least one transport service under option '%s'
in section '%s'.\n"),
+ LOG(LOG_WARNING,
+ _("You should specify at least one transport service"
+ " under option '%s' in section '%s'.\n"),
"TRANSPORTS", "GNUNETD");
} else {
LOG(LOG_DEBUG,
@@ -639,7 +644,8 @@
"inittransport_",
pos);
if (tptr == NULL)
- errexit(_("Transport library '%s' did not provide required function
'%s%s'.\n"),
+ errexit(_("Transport library '%s' did not provide "
+ "required function '%s%s'.\n"),
pos,
"inittransport_",
pos);
Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h 2005-06-30 20:49:04 UTC
(rev 1177)
+++ GNUnet/src/include/gnunet_transport_service.h 2005-06-30 21:48:28 UTC
(rev 1178)
@@ -176,7 +176,7 @@
* @param buff where to write the HELO messages
* @return the number of bytes written to buff, -1 on error
*/
- int (*getAdvertisedHELOs)(int maxLen,
+ int (*getAdvertisedHELOs)(unsigned int maxLen,
char * buff);
} Transport_ServiceAPI;
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2005-06-30 20:49:04 UTC (rev 1177)
+++ GNUnet/src/transports/udp.c 2005-06-30 21:48:28 UTC (rev 1178)
@@ -615,6 +615,7 @@
TransportAPI * inittransport_udp(CoreAPIForTransport * core) {
int mtu;
+ GNUNET_ASSERT(sizeof(UDPMessage) == 68);
coreAPI = core;
MUTEX_CREATE(&configLock);
reloadConfiguration();
Modified: GNUnet/src/transports/udp6.c
===================================================================
--- GNUnet/src/transports/udp6.c 2005-06-30 20:49:04 UTC (rev 1177)
+++ GNUnet/src/transports/udp6.c 2005-06-30 21:48:28 UTC (rev 1178)
@@ -68,6 +68,11 @@
unsigned short size;
/**
+ * Reserved for alignment, always 0.
+ */
+ unsigned short reserved;
+
+ /**
* What is the identity of the sender (hash of public key)
*/
PeerIdentity sender;
@@ -444,10 +449,9 @@
haddr = (Host6Address*) &((HELO_Message_GENERIC*)helo)->senderAddress[0];
ssize = size + sizeof(UDP6Message);
msg = MALLOC(ssize);
- mp.size = htons(ssize);
- memcpy(&mp.sender,
- coreAPI->myIdentity,
- sizeof(PeerIdentity));
+ mp.size = htons(ssize);
+ mp.reserved = 0;
+ mp.sender = *coreAPI->myIdentity;
memcpy(&msg[size],
&mp,
sizeof(UDP6Message));
@@ -617,6 +621,7 @@
TransportAPI * inittransport_udp6(CoreAPIForTransport * core) {
int mtu;
+ GNUNET_ASSERT(sizeof(UDP6Message) == 68);
coreAPI = core;
MUTEX_CREATE(&configLock);
reloadConfiguration();
Modified: GNUnet/src/util/generate
===================================================================
--- GNUnet/src/util/generate 2005-06-30 20:49:04 UTC (rev 1177)
+++ GNUnet/src/util/generate 2005-06-30 21:48:28 UTC (rev 1178)
@@ -13,7 +13,7 @@
echo " else";
echo " fprintf(f, \"GNUNETD_HOME = /var/lib/GNUnet\\n\");";
fi
-cat $1 | sed \
+cat $1 | grep -v "GNUNETD_HOME" | sed \
-e "s/\"/\\\\\"/g" \
-e "s/^/ fprintf(f, \"%s\\\\n\",\"/" \
-e "s/$/\");/"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1178 - in GNUnet: . m4 src/applications/advertising src/applications/fs/tools src/applications/pingpong src/applications/transport src/include src/transports src/util,
grothoff <=