diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_http.c | 4 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 4 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_http.c | 9 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 16 | ||||
-rw-r--r-- | src/transport/transport_api.c | 3 |
5 files changed, 21 insertions, 15 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 5946105ac..f512d3580 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -541,7 +541,7 @@ accessHandlerCallback (void *cls, | |||
541 | } | 541 | } |
542 | */ | 542 | */ |
543 | if (cs->msgtok==NULL) | 543 | if (cs->msgtok==NULL) |
544 | cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE, &messageTokenizerCallback, cs); | 544 | cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1, &messageTokenizerCallback, cs); |
545 | } | 545 | } |
546 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s' request from peer `%s'\n",method, GNUNET_i2s(&cs->identity)); | 546 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s' request from peer `%s'\n",method, GNUNET_i2s(&cs->identity)); |
547 | } | 547 | } |
@@ -570,7 +570,7 @@ accessHandlerCallback (void *cls, | |||
570 | 570 | ||
571 | if ((*upload_data_size > 0) && (cs->is_bad_request != GNUNET_YES)) | 571 | if ((*upload_data_size > 0) && (cs->is_bad_request != GNUNET_YES)) |
572 | { | 572 | { |
573 | if (*upload_data_size + cs->pending_inbound_msg.bytes_recv <= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 573 | if (*upload_data_size + cs->pending_inbound_msg.bytes_recv < GNUNET_SERVER_MAX_MESSAGE_SIZE) |
574 | { | 574 | { |
575 | /* copy uploaded data to buffer */ | 575 | /* copy uploaded data to buffer */ |
576 | 576 | ||
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 9b09d8948..c1397da61 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1120,7 +1120,7 @@ tcp_plugin_send (void *cls, | |||
1120 | } | 1120 | } |
1121 | sa = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, | 1121 | sa = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, |
1122 | af, sb, sbs, | 1122 | af, sb, sbs, |
1123 | GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1123 | GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); |
1124 | if (sa == NULL) | 1124 | if (sa == NULL) |
1125 | { | 1125 | { |
1126 | #if DEBUG_TCP | 1126 | #if DEBUG_TCP |
@@ -1991,7 +1991,7 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1991 | * that wants to connect to us! Send a message to establish a connection. | 1991 | * that wants to connect to us! Send a message to establish a connection. |
1992 | */ | 1992 | */ |
1993 | sock = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, AF_INET, (struct sockaddr *)&in_addr, | 1993 | sock = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, AF_INET, (struct sockaddr *)&in_addr, |
1994 | sizeof(in_addr), GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1994 | sizeof(in_addr), GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); |
1995 | if (sock == NULL) | 1995 | if (sock == NULL) |
1996 | { | 1996 | { |
1997 | plugin->server_read_task = | 1997 | plugin->server_read_task = |
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index 75df9c90a..9c98d8c06 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c | |||
@@ -1036,15 +1036,6 @@ static void run_connection_tests( ) | |||
1036 | api->send(api->cls, &my_identity, tmp, 425, 0, TIMEOUT, NULL,addr_head->addr, addr_head->addrlen, GNUNET_YES, &task_send_cont, NULL);*/ | 1036 | api->send(api->cls, &my_identity, tmp, 425, 0, TIMEOUT, NULL,addr_head->addr, addr_head->addrlen, GNUNET_YES, &task_send_cont, NULL);*/ |
1037 | 1037 | ||
1038 | 1038 | ||
1039 | /* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE )*/ | ||
1040 | /* | ||
1041 | GNUNET_free(tmp); | ||
1042 | tmp = GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
1043 | uint16_t t2 = (uint16_t)GNUNET_SERVER_MAX_MESSAGE_SIZE; | ||
1044 | msg.size = htons(t2); | ||
1045 | memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader)); | ||
1046 | 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); | ||
1047 | */ | ||
1048 | /* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE-1 */ | 1039 | /* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE-1 */ |
1049 | GNUNET_free(tmp); | 1040 | GNUNET_free(tmp); |
1050 | tmp = GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE-1); | 1041 | tmp = GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE-1); |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 755d5a576..4f00fa0d9 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise | 46 | * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise |
47 | * messages may be dropped even for a reliable transport. | 47 | * messages may be dropped even for a reliable transport. |
48 | */ | 48 | */ |
49 | #define TOTAL_MSGS (60000 * 2) | 49 | #define TOTAL_MSGS (60000 * 20) |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * How long until we give up on transmitting the message? | 52 | * How long until we give up on transmitting the message? |
@@ -152,6 +152,7 @@ static unsigned int | |||
152 | get_size (unsigned int iter) | 152 | get_size (unsigned int iter) |
153 | { | 153 | { |
154 | unsigned int ret; | 154 | unsigned int ret; |
155 | |||
155 | if (iter < 60000) | 156 | if (iter < 60000) |
156 | return iter + sizeof (struct TestMessage); | 157 | return iter + sizeof (struct TestMessage); |
157 | ret = (iter * iter * iter); | 158 | ret = (iter * iter * iter); |
@@ -168,6 +169,7 @@ notify_receive (void *cls, | |||
168 | { | 169 | { |
169 | static int n; | 170 | static int n; |
170 | unsigned int s; | 171 | unsigned int s; |
172 | char cbuf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1]; | ||
171 | const struct TestMessage *hdr; | 173 | const struct TestMessage *hdr; |
172 | 174 | ||
173 | hdr = (const struct TestMessage*) message; | 175 | hdr = (const struct TestMessage*) message; |
@@ -196,6 +198,18 @@ notify_receive (void *cls, | |||
196 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); | 198 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); |
197 | return; | 199 | return; |
198 | } | 200 | } |
201 | memset (cbuf, n, s - sizeof (struct TestMessage)); | ||
202 | if (0 != memcmp (cbuf, | ||
203 | &hdr[1], | ||
204 | s - sizeof (struct TestMessage))) | ||
205 | { | ||
206 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
207 | "Expected message %u with bits %u, but body did not match\n", | ||
208 | n, (unsigned char) n); | ||
209 | GNUNET_SCHEDULER_cancel (sched, die_task); | ||
210 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); | ||
211 | return; | ||
212 | } | ||
199 | #if VERBOSE | 213 | #if VERBOSE |
200 | if (ntohl(hdr->num) % 5000 == 0) | 214 | if (ntohl(hdr->num) % 5000 == 0) |
201 | { | 215 | { |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 2cd563178..d76ff6e5d 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -598,6 +598,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
598 | #endif | 598 | #endif |
599 | if (mret != 0) | 599 | if (mret != 0) |
600 | { | 600 | { |
601 | GNUNET_assert (mret + sizeof (struct OutboundMessage) < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
601 | obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); | 602 | obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); |
602 | obm.header.size = htons (mret + sizeof (struct OutboundMessage)); | 603 | obm.header.size = htons (mret + sizeof (struct OutboundMessage)); |
603 | obm.priority = htonl (th->priority); | 604 | obm.priority = htonl (th->priority); |
@@ -1699,7 +1700,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle | |||
1699 | #if DEBUG_TRANSPORT | 1700 | #if DEBUG_TRANSPORT |
1700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1701 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1701 | "Message size is %d, max allowed is %d.\n", | 1702 | "Message size is %d, max allowed is %d.\n", |
1702 | size + sizeof (struct OutboundMessage), GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1703 | size + sizeof (struct OutboundMessage), GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); |
1703 | #endif | 1704 | #endif |
1704 | GNUNET_break (0); | 1705 | GNUNET_break (0); |
1705 | return NULL; | 1706 | return NULL; |