[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11961 - in gnunet/src: arm core datastore dv fs hello host
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11961 - in gnunet/src: arm core datastore dv fs hello hostlist peerinfo topology transport util |
Date: |
Fri, 25 Jun 2010 23:08:56 +0200 |
Author: grothoff
Date: 2010-06-25 23:08:55 +0200 (Fri, 25 Jun 2010)
New Revision: 11961
Modified:
gnunet/src/arm/arm_api.c
gnunet/src/core/gnunet-service-core.c
gnunet/src/datastore/datastore_api.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/fs/fs_publish.c
gnunet/src/fs/gnunet-service-fs_indexing.c
gnunet/src/hello/hello.c
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/hostlist-server.c
gnunet/src/peerinfo/gnunet-service-peerinfo.c
gnunet/src/topology/gnunet-daemon-topology.c
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/test_plugin_transport_http.c
gnunet/src/transport/test_transport_api_reliability.c
gnunet/src/transport/transport_api.c
gnunet/src/util/client.c
gnunet/src/util/connection.c
gnunet/src/util/resolver_api.c
gnunet/src/util/server.c
gnunet/src/util/server_mst.c
gnunet/src/util/service.c
Log:
fixing common off-by-one error with respect to maximum message size
Modified: gnunet/src/arm/arm_api.c
===================================================================
--- gnunet/src/arm/arm_api.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/arm/arm_api.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -541,8 +541,7 @@
struct GNUNET_MessageHeader *msg;
slen = strlen (service_name) + 1;
- if (slen + sizeof (struct GNUNET_MessageHeader) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (slen + sizeof (struct GNUNET_MessageHeader) >=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
if (cb != NULL)
Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/core/gnunet-service-core.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -1717,7 +1717,7 @@
struct GNUNET_TIME_Relative *retry_time,
unsigned int *priority)
{
- char ntmb[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char ntmb[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
struct NotifyTrafficMessage *ntm = (struct NotifyTrafficMessage*) ntmb;
struct MessageEntry *pos;
struct MessageEntry *prev;
@@ -3824,7 +3824,7 @@
&handle_transport_notify_disconnect);
GNUNET_assert (NULL != transport);
stats = GNUNET_STATISTICS_create (sched, "core", cfg);
- mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
&deliver_message,
NULL);
GNUNET_SCHEDULER_add_delayed (sched,
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/datastore/datastore_api.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -245,7 +245,7 @@
if (c == NULL)
return NULL; /* oops */
h = GNUNET_malloc (sizeof(struct GNUNET_DATASTORE_Handle) +
- GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
h->client = c;
h->cfg = cfg;
h->sched = sched;
@@ -790,7 +790,7 @@
GNUNET_h2s (key));
#endif
msize = sizeof(struct DataMessage) + size;
- GNUNET_assert (msize <= GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
qc.sc.cont = cont;
qc.sc.cont_cls = cont_cls;
qe = make_queue_entry (h, msize,
@@ -1037,7 +1037,7 @@
qc.sc.cont = cont;
qc.sc.cont_cls = cont_cls;
msize = sizeof(struct DataMessage) + size;
- GNUNET_assert (msize <= GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
qe = make_queue_entry (h, msize,
queue_priority, max_queue_size, timeout,
&process_status_message, &qc);
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/dv/gnunet-service-dv.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -3002,7 +3002,7 @@
if (coreAPI == NULL)
return;
- coreMST = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ coreMST = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
&tokenized_message_handler,
NULL);
Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/fs/fs_publish.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -761,7 +761,7 @@
fn = GNUNET_STRINGS_filename_expand (p->filename);
GNUNET_assert (fn != NULL);
slen = strlen (fn) + 1;
- if (slen > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage))
+ if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct
IndexStartMessage))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Can not index file `%s': %s. Will try to insert
instead.\n"),
Modified: gnunet/src/fs/gnunet-service-fs_indexing.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_indexing.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/fs/gnunet-service-fs_indexing.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -430,7 +430,7 @@
{
struct GNUNET_SERVER_TransmitContext *tc;
struct IndexInfoMessage *iim;
- char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
size_t slen;
const char *fn;
struct IndexInfo *pos;
@@ -442,8 +442,7 @@
{
fn = pos->filename;
slen = strlen (fn) + 1;
- if (slen + sizeof (struct IndexInfoMessage) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (slen + sizeof (struct IndexInfoMessage) >=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
break;
Modified: gnunet/src/hello/hello.c
===================================================================
--- gnunet/src/hello/hello.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/hello/hello.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -167,7 +167,7 @@
GNUNET_HELLO_GenerateAddressListCallback addrgen,
void *addrgen_cls)
{
- char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 256 -
+ char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - 256 -
sizeof (struct GNUNET_HELLO_Message)];
size_t max;
size_t used;
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/hostlist/hostlist-client.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -272,7 +272,7 @@
size_t nmemb,
void *ctx)
{
- static char download_buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ static char download_buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
const char * cbuf = ptr;
const struct GNUNET_MessageHeader *msg;
size_t total;
@@ -295,7 +295,7 @@
while ( (left > 0) ||
(download_pos > 0) )
{
- cpy = GNUNET_MIN (left, GNUNET_SERVER_MAX_MESSAGE_SIZE - download_pos);
+ cpy = GNUNET_MIN (left, GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 -
download_pos);
memcpy (&download_buffer[download_pos],
cbuf,
cpy);
Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/hostlist/hostlist-server.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -399,7 +399,7 @@
if (hostlist_uri == NULL)
return;
size = strlen (hostlist_uri) + 1;
- if (size + sizeof (struct GNUNET_MessageHeader) >
GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (size + sizeof (struct GNUNET_MessageHeader) >=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
return;
Modified: gnunet/src/peerinfo/gnunet-service-peerinfo.c
===================================================================
--- gnunet/src/peerinfo/gnunet-service-peerinfo.c 2010-06-25 18:15:30 UTC
(rev 11960)
+++ gnunet/src/peerinfo/gnunet-service-peerinfo.c 2010-06-25 21:08:55 UTC
(rev 11961)
@@ -249,7 +249,7 @@
struct HostEntry *entry;
char *fn;
uint32_t trust;
- char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_HELLO_Message *hello_clean;
int size;
@@ -494,7 +494,7 @@
struct HostEntry *pos;
struct InfoMessage *im;
uint16_t hs;
- char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
struct GNUNET_SERVER_TransmitContext *tc;
int match;
@@ -600,7 +600,7 @@
discard_hosts_helper (void *cls, const char *fn)
{
struct GNUNET_TIME_Absolute *now = cls;
- char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_HELLO_Message *new_hello;
int size;
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2010-06-25 18:15:30 UTC
(rev 11960)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2010-06-25 21:08:55 UTC
(rev 11961)
@@ -629,7 +629,7 @@
/* find applicable HELLOs */
fah.peer = pl;
fah.result = NULL;
- fah.max_size = GNUNET_SERVER_MAX_MESSAGE_SIZE;
+ fah.max_size = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
fah.next_adv = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_CONTAINER_multihashmap_iterate (peers,
&find_advertisable_hello,
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2010-06-25 18:15:30 UTC
(rev 11960)
+++ gnunet/src/transport/plugin_transport_http.c 2010-06-25 21:08:55 UTC
(rev 11961)
@@ -541,7 +541,7 @@
}
*/
if (cs->msgtok==NULL)
- cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
&messageTokenizerCallback, cs);
+ cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE
- 1, &messageTokenizerCallback, cs);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s'
request from peer `%s'\n",method, GNUNET_i2s(&cs->identity));
}
@@ -570,7 +570,7 @@
if ((*upload_data_size > 0) && (cs->is_bad_request != GNUNET_YES))
{
- if (*upload_data_size + cs->pending_inbound_msg.bytes_recv <=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (*upload_data_size + cs->pending_inbound_msg.bytes_recv <
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
/* copy uploaded data to buffer */
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -1120,7 +1120,7 @@
}
sa = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched,
af, sb, sbs,
-
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
if (sa == NULL)
{
#if DEBUG_TCP
@@ -1991,7 +1991,7 @@
* that wants to connect to us! Send a message to establish a connection.
*/
sock = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, AF_INET,
(struct sockaddr *)&in_addr,
- sizeof(in_addr),
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ sizeof(in_addr),
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
if (sock == NULL)
{
plugin->server_read_task =
Modified: gnunet/src/transport/test_plugin_transport_http.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_http.c 2010-06-25 18:15:30 UTC
(rev 11960)
+++ gnunet/src/transport/test_plugin_transport_http.c 2010-06-25 21:08:55 UTC
(rev 11961)
@@ -1036,15 +1036,6 @@
api->send(api->cls, &my_identity, tmp, 425, 0, TIMEOUT,
NULL,addr_head->addr, addr_head->addrlen, GNUNET_YES, &task_send_cont, NULL);*/
- /* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE )*/
- /*
- GNUNET_free(tmp);
- tmp = GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE);
- uint16_t t2 = (uint16_t)GNUNET_SERVER_MAX_MESSAGE_SIZE;
- msg.size = htons(t2);
- memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader));
- api->send(api->cls, &my_identity, tmp, GNUNET_SERVER_MAX_MESSAGE_SIZE, 0,
TIMEOUT, NULL,addr_head->addr, addr_head->addrlen, GNUNET_YES, &task_send_cont,
&fail_msg_transmited_bigger_max_size);
-*/
/* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE-1 */
GNUNET_free(tmp);
tmp = GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE-1);
Modified: gnunet/src/transport/test_transport_api_reliability.c
===================================================================
--- gnunet/src/transport/test_transport_api_reliability.c 2010-06-25
18:15:30 UTC (rev 11960)
+++ gnunet/src/transport/test_transport_api_reliability.c 2010-06-25
21:08:55 UTC (rev 11961)
@@ -46,7 +46,7 @@
* 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
* messages may be dropped even for a reliable transport.
*/
-#define TOTAL_MSGS (60000 * 2)
+#define TOTAL_MSGS (60000 * 20)
/**
* How long until we give up on transmitting the message?
@@ -152,6 +152,7 @@
get_size (unsigned int iter)
{
unsigned int ret;
+
if (iter < 60000)
return iter + sizeof (struct TestMessage);
ret = (iter * iter * iter);
@@ -168,6 +169,7 @@
{
static int n;
unsigned int s;
+ char cbuf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
const struct TestMessage *hdr;
hdr = (const struct TestMessage*) message;
@@ -196,6 +198,18 @@
die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
return;
}
+ memset (cbuf, n, s - sizeof (struct TestMessage));
+ if (0 != memcmp (cbuf,
+ &hdr[1],
+ s - sizeof (struct TestMessage)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Expected message %u with bits %u, but body did not match\n",
+ n, (unsigned char) n);
+ GNUNET_SCHEDULER_cancel (sched, die_task);
+ die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL);
+ return;
+ }
#if VERBOSE
if (ntohl(hdr->num) % 5000 == 0)
{
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2010-06-25 18:15:30 UTC (rev
11960)
+++ gnunet/src/transport/transport_api.c 2010-06-25 21:08:55 UTC (rev
11961)
@@ -598,6 +598,7 @@
#endif
if (mret != 0)
{
+ GNUNET_assert (mret + sizeof (struct OutboundMessage) <
GNUNET_SERVER_MAX_MESSAGE_SIZE);
obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
obm.header.size = htons (mret + sizeof (struct OutboundMessage));
obm.priority = htonl (th->priority);
@@ -1699,7 +1700,7 @@
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Message size is %d, max allowed is %d.\n",
- size + sizeof (struct OutboundMessage),
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ size + sizeof (struct OutboundMessage),
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
#endif
GNUNET_break (0);
return NULL;
Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/client.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -291,7 +291,7 @@
sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (sched,
cfg,
unixpath,
-
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
GNUNET_free (unixpath);
if (sock != NULL)
return sock;
@@ -328,7 +328,7 @@
cfg,
hostname,
port,
-
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ GNUNET_SERVER_MAX_MESSAGE_SIZE
- 1);
GNUNET_free (hostname);
return sock;
}
@@ -579,7 +579,7 @@
GNUNET_assert (sock->in_receive == GNUNET_NO);
sock->in_receive = GNUNET_YES;
GNUNET_CONNECTION_receive (sock->sock,
- GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
timeout, &receive_helper, sock);
}
}
Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/connection.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -37,6 +37,7 @@
#include "gnunet_container_lib.h"
#include "gnunet_resolver_service.h"
#include "gnunet_scheduler_lib.h"
+#include "gnunet_server_lib.h"
#define DEBUG_CONNECTION GNUNET_NO
@@ -326,6 +327,7 @@
struct GNUNET_CONNECTION_Handle *ret;
ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
ret->write_buffer = (char *) &ret[1];
+ GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE);
ret->write_buffer_size = maxbuf;
ret->sock = osSocket;
ret->sched = sched;
@@ -416,6 +418,7 @@
}
ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
ret->write_buffer = (char *) &ret[1];
+ GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE);
ret->write_buffer_size = maxbuf;
ret->addr = uaddr;
ret->addrlen = addrlen;
@@ -873,6 +876,7 @@
ret->cfg = cfg;
ret->sched = sched;
ret->write_buffer = (char *) &ret[1];
+ GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE);
ret->write_buffer_size = maxbuf;
ret->port = port;
ret->hostname = GNUNET_strdup (hostname);
@@ -929,6 +933,7 @@
ret->cfg = cfg;
ret->sched = sched;
ret->write_buffer = (char *) &ret[1];
+ GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE);
ret->write_buffer_size = maxbuf;
ret->port = 0;
ret->hostname = NULL;
Modified: gnunet/src/util/resolver_api.c
===================================================================
--- gnunet/src/util/resolver_api.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/resolver_api.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -426,12 +426,11 @@
unsigned int i;
struct in_addr v4;
struct in6_addr v6;
- char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
check_config (cfg);
slen = strlen (hostname) + 1;
- if (slen + sizeof (struct GNUNET_RESOLVER_GetMessage) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (slen + sizeof (struct GNUNET_RESOLVER_GetMessage) >=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
return NULL;
@@ -619,7 +618,7 @@
struct GNUNET_CLIENT_Connection *client;
struct GNUNET_RESOLVER_GetMessage *msg;
struct GNUNET_RESOLVER_RequestHandle *rh;
- char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+ char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
check_config (cfg);
rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + salen);
@@ -636,8 +635,7 @@
&numeric_reverse, rh);
return rh;
}
- if (salen + sizeof (struct GNUNET_RESOLVER_GetMessage) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (salen + sizeof (struct GNUNET_RESOLVER_GetMessage) >=
GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
GNUNET_free (rh);
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/server.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -701,7 +701,7 @@
"Server re-enters receive loop.\n");
#endif
GNUNET_CONNECTION_receive (client->connection,
- GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
client->server->idle_timeout,
&process_incoming, client);
break;
@@ -811,7 +811,7 @@
#endif
client->receive_pending = GNUNET_YES;
GNUNET_CONNECTION_receive (client->connection,
- GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
client->server->idle_timeout,
&process_incoming, client);
return;
}
@@ -877,7 +877,7 @@
client = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Client));
client->connection = connection;
- client->mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ client->mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
&client_message_tokenizer_callback,
server);
client->reference_count = 1;
@@ -887,7 +887,7 @@
server->clients = client;
client->receive_pending = GNUNET_YES;
GNUNET_CONNECTION_receive (client->connection,
- GNUNET_SERVER_MAX_MESSAGE_SIZE,
+ GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
server->idle_timeout, &process_incoming, client);
return client;
}
Modified: gnunet/src/util/server_mst.c
===================================================================
--- gnunet/src/util/server_mst.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/server_mst.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -84,7 +84,7 @@
* Create a message stream tokenizer.
*
* @param maxbuf maximum message size to support (typically
- * GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ * GNUNET_SERVER_MAX_MESSAGE_SIZE - 1)
* @param cb function to call on completed messages
* @param cb_cls closure for cb
* @return handle to tokenizer
Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c 2010-06-25 18:15:30 UTC (rev 11960)
+++ gnunet/src/util/service.c 2010-06-25 21:08:55 UTC (rev 11961)
@@ -1140,7 +1140,7 @@
}
}
else
- maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
+ maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
sctx->serviceName, "TOLERANT"))
@@ -1577,7 +1577,7 @@
sctx.ready_confirm_fd = -1;
sctx.ret = GNUNET_OK;
sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL;
- sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
+ sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
sctx.task = task;
sctx.serviceName = serviceName;
sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
@@ -1656,7 +1656,7 @@
sctx->ready_confirm_fd = -1; /* no daemonizing */
sctx->ret = GNUNET_OK;
sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
- sctx->maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
+ sctx->maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
sctx->serviceName = serviceName;
sctx->cfg = cfg;
sctx->sched = sched;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11961 - in gnunet/src: arm core datastore dv fs hello hostlist peerinfo topology transport util,
gnunet <=