diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/client.c | 6 | ||||
-rw-r--r-- | src/util/connection.c | 46 | ||||
-rw-r--r-- | src/util/server.c | 17 | ||||
-rw-r--r-- | src/util/server_mst.c | 17 | ||||
-rw-r--r-- | src/util/service.c | 41 | ||||
-rw-r--r-- | src/util/test_client.c | 1 | ||||
-rw-r--r-- | src/util/test_connection.c | 6 | ||||
-rw-r--r-- | src/util/test_connection_addressing.c | 6 | ||||
-rw-r--r-- | src/util/test_connection_receive_cancel.c | 6 | ||||
-rw-r--r-- | src/util/test_connection_timeout.c | 4 | ||||
-rw-r--r-- | src/util/test_connection_timeout_no_connect.c | 2 | ||||
-rw-r--r-- | src/util/test_connection_transmit_cancel.c | 2 | ||||
-rw-r--r-- | src/util/test_server.c | 7 | ||||
-rw-r--r-- | src/util/test_server_disconnect.c | 3 | ||||
-rw-r--r-- | src/util/test_server_with_client.c | 1 |
15 files changed, 35 insertions, 130 deletions
diff --git a/src/util/client.c b/src/util/client.c index 4ec40d032..8526de92b 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -290,8 +290,7 @@ do_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
290 | { | 290 | { |
291 | sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (sched, | 291 | sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (sched, |
292 | cfg, | 292 | cfg, |
293 | unixpath, | 293 | unixpath); |
294 | GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); | ||
295 | GNUNET_free (unixpath); | 294 | GNUNET_free (unixpath); |
296 | if (sock != NULL) | 295 | if (sock != NULL) |
297 | return sock; | 296 | return sock; |
@@ -327,8 +326,7 @@ do_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
327 | sock = GNUNET_CONNECTION_create_from_connect (sched, | 326 | sock = GNUNET_CONNECTION_create_from_connect (sched, |
328 | cfg, | 327 | cfg, |
329 | hostname, | 328 | hostname, |
330 | port, | 329 | port); |
331 | GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); | ||
332 | GNUNET_free (hostname); | 330 | GNUNET_free (hostname); |
333 | return sock; | 331 | return sock; |
334 | } | 332 | } |
diff --git a/src/util/connection.c b/src/util/connection.c index 34c9fa62b..b1e68b0ef 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -214,11 +214,6 @@ struct GNUNET_CONNECTION_Handle | |||
214 | char *write_buffer; | 214 | char *write_buffer; |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Max size of our write buffer. | ||
218 | */ | ||
219 | size_t max_write_buffer_size; | ||
220 | |||
221 | /** | ||
222 | * Current size of our write buffer. | 217 | * Current size of our write buffer. |
223 | */ | 218 | */ |
224 | size_t write_buffer_size; | 219 | size_t write_buffer_size; |
@@ -319,21 +314,17 @@ void GNUNET_CONNECTION_persist_(struct GNUNET_CONNECTION_Handle *sock) | |||
319 | * | 314 | * |
320 | * @param sched scheduler to use | 315 | * @param sched scheduler to use |
321 | * @param osSocket existing socket to box | 316 | * @param osSocket existing socket to box |
322 | * @param maxbuf maximum write buffer size for the socket (use | ||
323 | * 0 for sockets that need no write buffers, such as listen sockets) | ||
324 | * @return the boxed socket handle | 317 | * @return the boxed socket handle |
325 | */ | 318 | */ |
326 | struct GNUNET_CONNECTION_Handle * | 319 | struct GNUNET_CONNECTION_Handle * |
327 | GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle | 320 | GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle |
328 | *sched, | 321 | *sched, |
329 | struct GNUNET_NETWORK_Handle | 322 | struct GNUNET_NETWORK_Handle |
330 | *osSocket, size_t maxbuf) | 323 | *osSocket) |
331 | { | 324 | { |
332 | struct GNUNET_CONNECTION_Handle *ret; | 325 | struct GNUNET_CONNECTION_Handle *ret; |
333 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 326 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); |
334 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
335 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 327 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
336 | ret->max_write_buffer_size = maxbuf; | ||
337 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); | 328 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); |
338 | ret->sock = osSocket; | 329 | ret->sock = osSocket; |
339 | ret->sched = sched; | 330 | ret->sched = sched; |
@@ -349,8 +340,6 @@ GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle | |||
349 | * @param access function to use to check if access is allowed | 340 | * @param access function to use to check if access is allowed |
350 | * @param access_cls closure for access | 341 | * @param access_cls closure for access |
351 | * @param lsock listen socket | 342 | * @param lsock listen socket |
352 | * @param maxbuf maximum write buffer size for the socket (use | ||
353 | * 0 for sockets that need no write buffers, such as listen sockets) | ||
354 | * @return the socket handle, NULL on error | 343 | * @return the socket handle, NULL on error |
355 | */ | 344 | */ |
356 | struct GNUNET_CONNECTION_Handle * | 345 | struct GNUNET_CONNECTION_Handle * |
@@ -358,8 +347,7 @@ GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle | |||
358 | *sched, | 347 | *sched, |
359 | GNUNET_CONNECTION_AccessCheck access, | 348 | GNUNET_CONNECTION_AccessCheck access, |
360 | void *access_cls, | 349 | void *access_cls, |
361 | struct GNUNET_NETWORK_Handle *lsock, | 350 | struct GNUNET_NETWORK_Handle *lsock) |
362 | size_t maxbuf) | ||
363 | { | 351 | { |
364 | struct GNUNET_CONNECTION_Handle *ret; | 352 | struct GNUNET_CONNECTION_Handle *ret; |
365 | char addr[128]; | 353 | char addr[128]; |
@@ -423,10 +411,7 @@ GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle | |||
423 | return NULL; | 411 | return NULL; |
424 | } | 412 | } |
425 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 413 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); |
426 | |||
427 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
428 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 414 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
429 | ret->max_write_buffer_size = maxbuf; | ||
430 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); | 415 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); |
431 | ret->addr = uaddr; | 416 | ret->addr = uaddr; |
432 | ret->addrlen = addrlen; | 417 | ret->addrlen = addrlen; |
@@ -870,16 +855,13 @@ try_connect_using_address (void *cls, | |||
870 | * @param cfg configuration to use | 855 | * @param cfg configuration to use |
871 | * @param hostname name of the host to connect to | 856 | * @param hostname name of the host to connect to |
872 | * @param port port to connect to | 857 | * @param port port to connect to |
873 | * @param maxbuf maximum write buffer size for the socket (use | ||
874 | * 0 for sockets that need no write buffers, such as listen sockets) | ||
875 | * @return the socket handle | 858 | * @return the socket handle |
876 | */ | 859 | */ |
877 | struct GNUNET_CONNECTION_Handle * | 860 | struct GNUNET_CONNECTION_Handle * |
878 | GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched, | 861 | GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched, |
879 | const struct | 862 | const struct |
880 | GNUNET_CONFIGURATION_Handle *cfg, | 863 | GNUNET_CONFIGURATION_Handle *cfg, |
881 | const char *hostname, uint16_t port, | 864 | const char *hostname, uint16_t port) |
882 | size_t maxbuf) | ||
883 | { | 865 | { |
884 | struct GNUNET_CONNECTION_Handle *ret; | 866 | struct GNUNET_CONNECTION_Handle *ret; |
885 | 867 | ||
@@ -887,10 +869,7 @@ GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
887 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 869 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); |
888 | ret->cfg = cfg; | 870 | ret->cfg = cfg; |
889 | ret->sched = sched; | 871 | ret->sched = sched; |
890 | |||
891 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
892 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 872 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
893 | ret->max_write_buffer_size = maxbuf; | ||
894 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); | 873 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); |
895 | ret->port = port; | 874 | ret->port = port; |
896 | ret->hostname = GNUNET_strdup (hostname); | 875 | ret->hostname = GNUNET_strdup (hostname); |
@@ -912,16 +891,13 @@ GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
912 | * @param sched scheduler to use | 891 | * @param sched scheduler to use |
913 | * @param cfg configuration to use | 892 | * @param cfg configuration to use |
914 | * @param unixpath path to connect to | 893 | * @param unixpath path to connect to |
915 | * @param maxbuf maximum write buffer size for the socket (use | ||
916 | * 0 for sockets that need no write buffers, such as listen sockets) | ||
917 | * @return the socket handle, NULL on systems without UNIX support | 894 | * @return the socket handle, NULL on systems without UNIX support |
918 | */ | 895 | */ |
919 | struct GNUNET_CONNECTION_Handle * | 896 | struct GNUNET_CONNECTION_Handle * |
920 | GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handle *sched, | 897 | GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handle *sched, |
921 | const struct | 898 | const struct |
922 | GNUNET_CONFIGURATION_Handle *cfg, | 899 | GNUNET_CONFIGURATION_Handle *cfg, |
923 | const char *unixpath, | 900 | const char *unixpath) |
924 | size_t maxbuf) | ||
925 | { | 901 | { |
926 | #ifdef AF_UNIX | 902 | #ifdef AF_UNIX |
927 | struct GNUNET_CONNECTION_Handle *ret; | 903 | struct GNUNET_CONNECTION_Handle *ret; |
@@ -946,9 +922,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handl | |||
946 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 922 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); |
947 | ret->cfg = cfg; | 923 | ret->cfg = cfg; |
948 | ret->sched = sched; | 924 | ret->sched = sched; |
949 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
950 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 925 | ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
951 | ret->max_write_buffer_size = maxbuf; | ||
952 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); | 926 | ret->write_buffer = GNUNET_malloc(ret->write_buffer_size); |
953 | ret->port = 0; | 927 | ret->port = 0; |
954 | ret->hostname = NULL; | 928 | ret->hostname = NULL; |
@@ -987,15 +961,13 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handl | |||
987 | * @param af_family address family to use | 961 | * @param af_family address family to use |
988 | * @param serv_addr server address | 962 | * @param serv_addr server address |
989 | * @param addrlen length of server address | 963 | * @param addrlen length of server address |
990 | * @param maxbuf maximum write buffer size for the socket (use | ||
991 | * 0 for sockets that need no write buffers, such as listen sockets) | ||
992 | * @return the socket handle | 964 | * @return the socket handle |
993 | */ | 965 | */ |
994 | struct GNUNET_CONNECTION_Handle * | 966 | struct GNUNET_CONNECTION_Handle * |
995 | GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle | 967 | GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle |
996 | *sched, int af_family, | 968 | *sched, int af_family, |
997 | const struct sockaddr *serv_addr, | 969 | const struct sockaddr *serv_addr, |
998 | socklen_t addrlen, size_t maxbuf) | 970 | socklen_t addrlen) |
999 | { | 971 | { |
1000 | struct GNUNET_NETWORK_Handle *s; | 972 | struct GNUNET_NETWORK_Handle *s; |
1001 | struct GNUNET_CONNECTION_Handle *ret; | 973 | struct GNUNET_CONNECTION_Handle *ret; |
@@ -1015,7 +987,7 @@ GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle | |||
1015 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s)); | 987 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s)); |
1016 | return NULL; | 988 | return NULL; |
1017 | } | 989 | } |
1018 | ret = GNUNET_CONNECTION_create_from_existing (sched, s, maxbuf); | 990 | ret = GNUNET_CONNECTION_create_from_existing (sched, s); |
1019 | ret->addr = GNUNET_malloc (addrlen); | 991 | ret->addr = GNUNET_malloc (addrlen); |
1020 | memcpy (ret->addr, serv_addr, addrlen); | 992 | memcpy (ret->addr, serv_addr, addrlen); |
1021 | ret->addrlen = addrlen; | 993 | ret->addrlen = addrlen; |
@@ -1615,11 +1587,11 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle | |||
1615 | if (sock->nth.notify_ready != NULL) | 1587 | if (sock->nth.notify_ready != NULL) |
1616 | return NULL; | 1588 | return NULL; |
1617 | GNUNET_assert (notify != NULL); | 1589 | GNUNET_assert (notify != NULL); |
1618 | if ((sock->write_buffer_size < size) && (size < sock->max_write_buffer_size)) | 1590 | if ((sock->write_buffer_size < size) && (size < GNUNET_SERVER_MAX_MESSAGE_SIZE)) |
1619 | { | 1591 | { |
1620 | temp_size = sock->write_buffer_size + size; | 1592 | temp_size = sock->write_buffer_size + size; |
1621 | if (temp_size > sock->max_write_buffer_size) | 1593 | if (temp_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1622 | temp_size = sock->max_write_buffer_size; | 1594 | temp_size = GNUNET_SERVER_MAX_MESSAGE_SIZE; |
1623 | 1595 | ||
1624 | sock->write_buffer = GNUNET_realloc(sock->write_buffer, temp_size); | 1596 | sock->write_buffer = GNUNET_realloc(sock->write_buffer, temp_size); |
1625 | sock->write_buffer_size = temp_size; | 1597 | sock->write_buffer_size = temp_size; |
diff --git a/src/util/server.c b/src/util/server.c index 606d44369..3011f4927 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -122,11 +122,6 @@ struct GNUNET_SERVER_Handle | |||
122 | struct GNUNET_TIME_Relative idle_timeout; | 122 | struct GNUNET_TIME_Relative idle_timeout; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * maximum write buffer size for accepted sockets | ||
126 | */ | ||
127 | size_t maxbuf; | ||
128 | |||
129 | /** | ||
130 | * Task scheduled to do the listening. | 125 | * Task scheduled to do the listening. |
131 | */ | 126 | */ |
132 | GNUNET_SCHEDULER_TaskIdentifier listen_task; | 127 | GNUNET_SCHEDULER_TaskIdentifier listen_task; |
@@ -273,8 +268,7 @@ process_listen_socket (void *cls, | |||
273 | sock = | 268 | sock = |
274 | GNUNET_CONNECTION_create_from_accept (tc->sched, server->access, | 269 | GNUNET_CONNECTION_create_from_accept (tc->sched, server->access, |
275 | server->access_cls, | 270 | server->access_cls, |
276 | server->listen_sockets[i], | 271 | server->listen_sockets[i]); |
277 | server->maxbuf); | ||
278 | if (sock != NULL) | 272 | if (sock != NULL) |
279 | { | 273 | { |
280 | #if DEBUG_SERVER | 274 | #if DEBUG_SERVER |
@@ -396,7 +390,6 @@ open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen) | |||
396 | * @param access function for access control | 390 | * @param access function for access control |
397 | * @param access_cls closure for access | 391 | * @param access_cls closure for access |
398 | * @param lsocks NULL-terminated array of listen sockets | 392 | * @param lsocks NULL-terminated array of listen sockets |
399 | * @param maxbuf maximum write buffer size for accepted sockets | ||
400 | * @param idle_timeout after how long should we timeout idle connections? | 393 | * @param idle_timeout after how long should we timeout idle connections? |
401 | * @param require_found if YES, connections sending messages of unknown type | 394 | * @param require_found if YES, connections sending messages of unknown type |
402 | * will be closed | 395 | * will be closed |
@@ -407,7 +400,6 @@ struct GNUNET_SERVER_Handle * | |||
407 | GNUNET_SERVER_create_with_sockets (struct GNUNET_SCHEDULER_Handle *sched, | 400 | GNUNET_SERVER_create_with_sockets (struct GNUNET_SCHEDULER_Handle *sched, |
408 | GNUNET_CONNECTION_AccessCheck access, void *access_cls, | 401 | GNUNET_CONNECTION_AccessCheck access, void *access_cls, |
409 | struct GNUNET_NETWORK_Handle **lsocks, | 402 | struct GNUNET_NETWORK_Handle **lsocks, |
410 | size_t maxbuf, | ||
411 | struct GNUNET_TIME_Relative | 403 | struct GNUNET_TIME_Relative |
412 | idle_timeout, | 404 | idle_timeout, |
413 | int require_found) | 405 | int require_found) |
@@ -418,7 +410,6 @@ GNUNET_SERVER_create_with_sockets (struct GNUNET_SCHEDULER_Handle *sched, | |||
418 | 410 | ||
419 | ret = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Handle)); | 411 | ret = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Handle)); |
420 | ret->sched = sched; | 412 | ret->sched = sched; |
421 | ret->maxbuf = maxbuf; | ||
422 | ret->idle_timeout = idle_timeout; | 413 | ret->idle_timeout = idle_timeout; |
423 | ret->listen_sockets = lsocks; | 414 | ret->listen_sockets = lsocks; |
424 | ret->access = access; | 415 | ret->access = access; |
@@ -451,7 +442,6 @@ GNUNET_SERVER_create_with_sockets (struct GNUNET_SCHEDULER_Handle *sched, | |||
451 | * @param access_cls closure for access | 442 | * @param access_cls closure for access |
452 | * @param serverAddr address to listen on (including port), NULL terminated array | 443 | * @param serverAddr address to listen on (including port), NULL terminated array |
453 | * @param socklen length of serverAddr | 444 | * @param socklen length of serverAddr |
454 | * @param maxbuf maximum write buffer size for accepted sockets | ||
455 | * @param idle_timeout after how long should we timeout idle connections? | 445 | * @param idle_timeout after how long should we timeout idle connections? |
456 | * @param require_found if YES, connections sending messages of unknown type | 446 | * @param require_found if YES, connections sending messages of unknown type |
457 | * will be closed | 447 | * will be closed |
@@ -464,7 +454,6 @@ GNUNET_SERVER_create (struct GNUNET_SCHEDULER_Handle *sched, | |||
464 | void *access_cls, | 454 | void *access_cls, |
465 | struct sockaddr *const *serverAddr, | 455 | struct sockaddr *const *serverAddr, |
466 | const socklen_t * socklen, | 456 | const socklen_t * socklen, |
467 | size_t maxbuf, | ||
468 | struct GNUNET_TIME_Relative | 457 | struct GNUNET_TIME_Relative |
469 | idle_timeout, int require_found) | 458 | idle_timeout, int require_found) |
470 | { | 459 | { |
@@ -503,7 +492,6 @@ GNUNET_SERVER_create (struct GNUNET_SCHEDULER_Handle *sched, | |||
503 | return GNUNET_SERVER_create_with_sockets (sched, | 492 | return GNUNET_SERVER_create_with_sockets (sched, |
504 | access, access_cls, | 493 | access, access_cls, |
505 | lsocks, | 494 | lsocks, |
506 | maxbuf, | ||
507 | idle_timeout, | 495 | idle_timeout, |
508 | require_found); | 496 | require_found); |
509 | } | 497 | } |
@@ -877,8 +865,7 @@ GNUNET_SERVER_connect_socket (struct | |||
877 | 865 | ||
878 | client = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Client)); | 866 | client = GNUNET_malloc (sizeof (struct GNUNET_SERVER_Client)); |
879 | client->connection = connection; | 867 | client->connection = connection; |
880 | client->mst = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1, | 868 | client->mst = GNUNET_SERVER_mst_create (&client_message_tokenizer_callback, |
881 | &client_message_tokenizer_callback, | ||
882 | server); | 869 | server); |
883 | client->reference_count = 1; | 870 | client->reference_count = 1; |
884 | client->server = server; | 871 | client->server = server; |
diff --git a/src/util/server_mst.c b/src/util/server_mst.c index d7a109f3b..505d98998 100644 --- a/src/util/server_mst.c +++ b/src/util/server_mst.c | |||
@@ -62,11 +62,6 @@ struct GNUNET_SERVER_MessageStreamTokenizer | |||
62 | size_t curr_buf; | 62 | size_t curr_buf; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Maximum size of the buffer. | ||
66 | */ | ||
67 | size_t maxbuf; | ||
68 | |||
69 | /** | ||
70 | * How many bytes in buffer have we already processed? | 65 | * How many bytes in buffer have we already processed? |
71 | */ | 66 | */ |
72 | size_t off; | 67 | size_t off; |
@@ -88,15 +83,12 @@ struct GNUNET_SERVER_MessageStreamTokenizer | |||
88 | /** | 83 | /** |
89 | * Create a message stream tokenizer. | 84 | * Create a message stream tokenizer. |
90 | * | 85 | * |
91 | * @param maxbuf maximum message size to support (typically | ||
92 | * GNUNET_SERVER_MAX_MESSAGE_SIZE - 1) | ||
93 | * @param cb function to call on completed messages | 86 | * @param cb function to call on completed messages |
94 | * @param cb_cls closure for cb | 87 | * @param cb_cls closure for cb |
95 | * @return handle to tokenizer | 88 | * @return handle to tokenizer |
96 | */ | 89 | */ |
97 | struct GNUNET_SERVER_MessageStreamTokenizer * | 90 | struct GNUNET_SERVER_MessageStreamTokenizer * |
98 | GNUNET_SERVER_mst_create (size_t maxbuf, | 91 | GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, |
99 | GNUNET_SERVER_MessageTokenizerCallback cb, | ||
100 | void *cb_cls) | 92 | void *cb_cls) |
101 | { | 93 | { |
102 | struct GNUNET_SERVER_MessageStreamTokenizer *ret; | 94 | struct GNUNET_SERVER_MessageStreamTokenizer *ret; |
@@ -104,7 +96,6 @@ GNUNET_SERVER_mst_create (size_t maxbuf, | |||
104 | ret = GNUNET_malloc (sizeof (struct GNUNET_SERVER_MessageStreamTokenizer)); | 96 | ret = GNUNET_malloc (sizeof (struct GNUNET_SERVER_MessageStreamTokenizer)); |
105 | ret->hdr = GNUNET_malloc(GNUNET_SERVER_MIN_BUFFER_SIZE); | 97 | ret->hdr = GNUNET_malloc(GNUNET_SERVER_MIN_BUFFER_SIZE); |
106 | ret->curr_buf = GNUNET_SERVER_MIN_BUFFER_SIZE; | 98 | ret->curr_buf = GNUNET_SERVER_MIN_BUFFER_SIZE; |
107 | ret->maxbuf = maxbuf; | ||
108 | ret->cb = cb; | 99 | ret->cb = cb; |
109 | ret->cb_cls = cb_cls; | 100 | ret->cb_cls = cb_cls; |
110 | return ret; | 101 | return ret; |
@@ -149,11 +140,11 @@ GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | |||
149 | (unsigned int) size, | 140 | (unsigned int) size, |
150 | (unsigned int) (mst->pos - mst->off)); | 141 | (unsigned int) (mst->pos - mst->off)); |
151 | #endif | 142 | #endif |
152 | if ((size > mst->curr_buf) && (size < mst->maxbuf)) /* Received bigger message than we can currently handle! */ | 143 | if ((size > mst->curr_buf) && (size < GNUNET_SERVER_MAX_MESSAGE_SIZE)) /* Received bigger message than we can currently handle! */ |
153 | { | 144 | { |
154 | newsize = mst->curr_buf + size; /* How much space do we need? */ | 145 | newsize = mst->curr_buf + size; /* How much space do we need? */ |
155 | if (newsize > mst->maxbuf) | 146 | if (newsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
156 | newsize = mst->maxbuf; /* Check it's not bigger than maxbuf */ | 147 | newsize = GNUNET_SERVER_MAX_MESSAGE_SIZE; /* Check it's not bigger than GNUNET_SERVER_MAX_MESSAGE_SIZE */ |
157 | 148 | ||
158 | mst->hdr = GNUNET_realloc(mst->hdr, newsize); | 149 | mst->hdr = GNUNET_realloc(mst->hdr, newsize); |
159 | mst->curr_buf = newsize; | 150 | mst->curr_buf = newsize; |
diff --git a/src/util/service.c b/src/util/service.c index c34c5aa32..99a364f15 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -499,11 +499,6 @@ struct GNUNET_SERVICE_Context | |||
499 | struct GNUNET_TIME_Relative timeout; | 499 | struct GNUNET_TIME_Relative timeout; |
500 | 500 | ||
501 | /** | 501 | /** |
502 | * Maximum buffer size for the server. | ||
503 | */ | ||
504 | size_t maxbuf; | ||
505 | |||
506 | /** | ||
507 | * Overall success/failure of the service start. | 502 | * Overall success/failure of the service start. |
508 | */ | 503 | */ |
509 | int ret; | 504 | int ret; |
@@ -1077,14 +1072,13 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
1077 | 1072 | ||
1078 | 1073 | ||
1079 | /** | 1074 | /** |
1080 | * Setup addr, addrlen, maxbuf, idle_timeout | 1075 | * Setup addr, addrlen, idle_timeout |
1081 | * based on configuration! | 1076 | * based on configuration! |
1082 | * | 1077 | * |
1083 | * Configuration may specify: | 1078 | * Configuration may specify: |
1084 | * - PORT (where to bind to for TCP) | 1079 | * - PORT (where to bind to for TCP) |
1085 | * - UNIXPATH (where to bind to for UNIX domain sockets) | 1080 | * - UNIXPATH (where to bind to for UNIX domain sockets) |
1086 | * - TIMEOUT (after how many ms does an inactive service timeout); | 1081 | * - TIMEOUT (after how many ms does an inactive service timeout); |
1087 | * - MAXBUF (maximum incoming message size supported) | ||
1088 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) | 1082 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) |
1089 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) | 1083 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) |
1090 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) | 1084 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) |
@@ -1097,7 +1091,6 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
1097 | static int | 1091 | static int |
1098 | setup_service (struct GNUNET_SERVICE_Context *sctx) | 1092 | setup_service (struct GNUNET_SERVICE_Context *sctx) |
1099 | { | 1093 | { |
1100 | unsigned long long maxbuf; | ||
1101 | struct GNUNET_TIME_Relative idleout; | 1094 | struct GNUNET_TIME_Relative idleout; |
1102 | int tolerant; | 1095 | int tolerant; |
1103 | const char *lpid; | 1096 | const char *lpid; |
@@ -1124,23 +1117,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
1124 | } | 1117 | } |
1125 | else | 1118 | else |
1126 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1119 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1127 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
1128 | sctx->serviceName, "MAXBUF")) | ||
1129 | { | ||
1130 | if (GNUNET_OK != | ||
1131 | GNUNET_CONFIGURATION_get_value_number (sctx->cfg, | ||
1132 | sctx->serviceName, | ||
1133 | "MAXBUF", &maxbuf)) | ||
1134 | { | ||
1135 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1136 | _("Specified value for `%s' of service `%s' is invalid\n"), | ||
1137 | "MAXBUF", | ||
1138 | sctx->serviceName); | ||
1139 | return GNUNET_SYSERR; | ||
1140 | } | ||
1141 | } | ||
1142 | else | ||
1143 | maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1; | ||
1144 | 1120 | ||
1145 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | 1121 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, |
1146 | sctx->serviceName, "TOLERANT")) | 1122 | sctx->serviceName, "TOLERANT")) |
@@ -1201,15 +1177,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
1201 | &sctx->addrlens)) ) | 1177 | &sctx->addrlens)) ) |
1202 | return GNUNET_SYSERR; | 1178 | return GNUNET_SYSERR; |
1203 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; | 1179 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; |
1204 | sctx->maxbuf = (size_t) maxbuf; | ||
1205 | if (sctx->maxbuf != maxbuf) | ||
1206 | { | ||
1207 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1208 | _ | ||
1209 | ("Value in configuration for `%s' and service `%s' too large!\n"), | ||
1210 | "MAXBUF", sctx->serviceName); | ||
1211 | return GNUNET_SYSERR; | ||
1212 | } | ||
1213 | 1180 | ||
1214 | process_acl4 (&sctx->v4_denied, sctx, "REJECT_FROM"); | 1181 | process_acl4 (&sctx->v4_denied, sctx, "REJECT_FROM"); |
1215 | process_acl4 (&sctx->v4_allowed, sctx, "ACCEPT_FROM"); | 1182 | process_acl4 (&sctx->v4_allowed, sctx, "ACCEPT_FROM"); |
@@ -1324,7 +1291,6 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1324 | &check_access, | 1291 | &check_access, |
1325 | sctx, | 1292 | sctx, |
1326 | sctx->lsocks, | 1293 | sctx->lsocks, |
1327 | sctx->maxbuf, | ||
1328 | sctx->timeout, sctx->require_found); | 1294 | sctx->timeout, sctx->require_found); |
1329 | else | 1295 | else |
1330 | sctx->server = GNUNET_SERVER_create (tc->sched, | 1296 | sctx->server = GNUNET_SERVER_create (tc->sched, |
@@ -1332,7 +1298,6 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1332 | sctx, | 1298 | sctx, |
1333 | sctx->addrs, | 1299 | sctx->addrs, |
1334 | sctx->addrlens, | 1300 | sctx->addrlens, |
1335 | sctx->maxbuf, | ||
1336 | sctx->timeout, sctx->require_found); | 1301 | sctx->timeout, sctx->require_found); |
1337 | if (sctx->server == NULL) | 1302 | if (sctx->server == NULL) |
1338 | { | 1303 | { |
@@ -1577,7 +1542,6 @@ GNUNET_SERVICE_run (int argc, | |||
1577 | sctx.ready_confirm_fd = -1; | 1542 | sctx.ready_confirm_fd = -1; |
1578 | sctx.ret = GNUNET_OK; | 1543 | sctx.ret = GNUNET_OK; |
1579 | sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1544 | sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1580 | sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1; | ||
1581 | sctx.task = task; | 1545 | sctx.task = task; |
1582 | sctx.serviceName = serviceName; | 1546 | sctx.serviceName = serviceName; |
1583 | sctx.cfg = cfg = GNUNET_CONFIGURATION_create (); | 1547 | sctx.cfg = cfg = GNUNET_CONFIGURATION_create (); |
@@ -1656,7 +1620,6 @@ GNUNET_SERVICE_start (const char *serviceName, | |||
1656 | sctx->ready_confirm_fd = -1; /* no daemonizing */ | 1620 | sctx->ready_confirm_fd = -1; /* no daemonizing */ |
1657 | sctx->ret = GNUNET_OK; | 1621 | sctx->ret = GNUNET_OK; |
1658 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1622 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1659 | sctx->maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; | ||
1660 | sctx->serviceName = serviceName; | 1623 | sctx->serviceName = serviceName; |
1661 | sctx->cfg = cfg; | 1624 | sctx->cfg = cfg; |
1662 | sctx->sched = sched; | 1625 | sctx->sched = sched; |
@@ -1672,7 +1635,6 @@ GNUNET_SERVICE_start (const char *serviceName, | |||
1672 | &check_access, | 1635 | &check_access, |
1673 | sctx, | 1636 | sctx, |
1674 | sctx->lsocks, | 1637 | sctx->lsocks, |
1675 | sctx->maxbuf, | ||
1676 | sctx->timeout, sctx->require_found); | 1638 | sctx->timeout, sctx->require_found); |
1677 | else | 1639 | else |
1678 | sctx->server = GNUNET_SERVER_create (sched, | 1640 | sctx->server = GNUNET_SERVER_create (sched, |
@@ -1680,7 +1642,6 @@ GNUNET_SERVICE_start (const char *serviceName, | |||
1680 | sctx, | 1642 | sctx, |
1681 | sctx->addrs, | 1643 | sctx->addrs, |
1682 | sctx->addrlens, | 1644 | sctx->addrlens, |
1683 | sctx->maxbuf, | ||
1684 | sctx->timeout, | 1645 | sctx->timeout, |
1685 | sctx->require_found); | 1646 | sctx->require_found); |
1686 | 1647 | ||
diff --git a/src/util/test_client.c b/src/util/test_client.c index 4d436e810..ead6751a4 100644 --- a/src/util/test_client.c +++ b/src/util/test_client.c | |||
@@ -155,7 +155,6 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
155 | NULL, | 155 | NULL, |
156 | sap, | 156 | sap, |
157 | slens, | 157 | slens, |
158 | 1024, | ||
159 | GNUNET_TIME_relative_multiply | 158 | GNUNET_TIME_relative_multiply |
160 | (GNUNET_TIME_UNIT_MILLISECONDS, 10000), | 159 | (GNUNET_TIME_UNIT_MILLISECONDS, 10000), |
161 | GNUNET_NO); | 160 | GNUNET_NO); |
diff --git a/src/util/test_connection.c b/src/util/test_connection.c index d8e86a6eb..0cc02059d 100644 --- a/src/util/test_connection.c +++ b/src/util/test_connection.c | |||
@@ -119,7 +119,7 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
119 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n"); | 119 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n"); |
120 | #endif | 120 | #endif |
121 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, | 121 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, |
122 | NULL, NULL, ls, 1024); | 122 | NULL, NULL, ls); |
123 | GNUNET_assert (asock != NULL); | 123 | GNUNET_assert (asock != NULL); |
124 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); | 124 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); |
125 | #if VERBOSE | 125 | #if VERBOSE |
@@ -157,11 +157,11 @@ static void | |||
157 | task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 157 | task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
158 | { | 158 | { |
159 | ls = open_listen_socket (); | 159 | ls = open_listen_socket (); |
160 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls, 0); | 160 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls); |
161 | GNUNET_assert (lsock != NULL); | 161 | GNUNET_assert (lsock != NULL); |
162 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, | 162 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, |
163 | cfg, | 163 | cfg, |
164 | "localhost", PORT, 1024); | 164 | "localhost", PORT); |
165 | GNUNET_assert (csock != NULL); | 165 | GNUNET_assert (csock != NULL); |
166 | #if VERBOSE | 166 | #if VERBOSE |
167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); | 167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); |
diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c index 83eea375c..4c10bd074 100644 --- a/src/util/test_connection_addressing.c +++ b/src/util/test_connection_addressing.c | |||
@@ -116,7 +116,7 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
116 | struct sockaddr_in expect; | 116 | struct sockaddr_in expect; |
117 | 117 | ||
118 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, | 118 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, |
119 | NULL, NULL, ls, 1024); | 119 | NULL, NULL, ls); |
120 | GNUNET_assert (asock != NULL); | 120 | GNUNET_assert (asock != NULL); |
121 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); | 121 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); |
122 | GNUNET_assert (GNUNET_OK == | 122 | GNUNET_assert (GNUNET_OK == |
@@ -153,7 +153,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
153 | { | 153 | { |
154 | struct sockaddr_in v4; | 154 | struct sockaddr_in v4; |
155 | ls = open_listen_socket (); | 155 | ls = open_listen_socket (); |
156 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls, 0); | 156 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls); |
157 | GNUNET_assert (lsock != NULL); | 157 | GNUNET_assert (lsock != NULL); |
158 | 158 | ||
159 | #if HAVE_SOCKADDR_IN_SIN_LEN | 159 | #if HAVE_SOCKADDR_IN_SIN_LEN |
@@ -165,7 +165,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
165 | csock = GNUNET_CONNECTION_create_from_sockaddr (tc->sched, | 165 | csock = GNUNET_CONNECTION_create_from_sockaddr (tc->sched, |
166 | AF_INET, | 166 | AF_INET, |
167 | (const struct sockaddr | 167 | (const struct sockaddr |
168 | *) &v4, sizeof (v4), 1024); | 168 | *) &v4, sizeof (v4)); |
169 | GNUNET_assert (csock != NULL); | 169 | GNUNET_assert (csock != NULL); |
170 | GNUNET_assert (NULL != | 170 | GNUNET_assert (NULL != |
171 | GNUNET_CONNECTION_notify_transmit_ready (csock, | 171 | GNUNET_CONNECTION_notify_transmit_ready (csock, |
diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c index db5f573df..e4d7111d4 100644 --- a/src/util/test_connection_receive_cancel.c +++ b/src/util/test_connection_receive_cancel.c | |||
@@ -91,7 +91,7 @@ run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
91 | { | 91 | { |
92 | 92 | ||
93 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, | 93 | asock = GNUNET_CONNECTION_create_from_accept (tc->sched, |
94 | NULL, NULL, ls, 1024); | 94 | NULL, NULL, ls); |
95 | GNUNET_assert (asock != NULL); | 95 | GNUNET_assert (asock != NULL); |
96 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); | 96 | GNUNET_assert (GNUNET_YES == GNUNET_CONNECTION_check (asock)); |
97 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); | 97 | GNUNET_CONNECTION_destroy (lsock, GNUNET_YES); |
@@ -119,10 +119,10 @@ static void | |||
119 | task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 119 | task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
120 | { | 120 | { |
121 | ls = open_listen_socket (); | 121 | ls = open_listen_socket (); |
122 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls, 0); | 122 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls); |
123 | GNUNET_assert (lsock != NULL); | 123 | GNUNET_assert (lsock != NULL); |
124 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, | 124 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, |
125 | "localhost", PORT, 1024); | 125 | "localhost", PORT); |
126 | GNUNET_assert (csock != NULL); | 126 | GNUNET_assert (csock != NULL); |
127 | GNUNET_SCHEDULER_add_read_net (tc->sched, | 127 | GNUNET_SCHEDULER_add_read_net (tc->sched, |
128 | GNUNET_TIME_UNIT_FOREVER_REL, | 128 | GNUNET_TIME_UNIT_FOREVER_REL, |
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c index b7a1ea94e..5291ad3c4 100644 --- a/src/util/test_connection_timeout.c +++ b/src/util/test_connection_timeout.c | |||
@@ -107,10 +107,10 @@ task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
107 | { | 107 | { |
108 | 108 | ||
109 | ls = open_listen_socket (); | 109 | ls = open_listen_socket (); |
110 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls, 0); | 110 | lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls); |
111 | GNUNET_assert (lsock != NULL); | 111 | GNUNET_assert (lsock != NULL); |
112 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, | 112 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, |
113 | "localhost", PORT, 1024); | 113 | "localhost", PORT); |
114 | GNUNET_assert (csock != NULL); | 114 | GNUNET_assert (csock != NULL); |
115 | GNUNET_assert (NULL != | 115 | GNUNET_assert (NULL != |
116 | GNUNET_CONNECTION_notify_transmit_ready (csock, | 116 | GNUNET_CONNECTION_notify_transmit_ready (csock, |
diff --git a/src/util/test_connection_timeout_no_connect.c b/src/util/test_connection_timeout_no_connect.c index c37824c25..468e965ca 100644 --- a/src/util/test_connection_timeout_no_connect.c +++ b/src/util/test_connection_timeout_no_connect.c | |||
@@ -54,7 +54,7 @@ static void | |||
54 | task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 54 | task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
55 | { | 55 | { |
56 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, | 56 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, |
57 | "localhost", PORT, 1024); | 57 | "localhost", PORT); |
58 | GNUNET_assert (csock != NULL); | 58 | GNUNET_assert (csock != NULL); |
59 | GNUNET_assert (NULL != | 59 | GNUNET_assert (NULL != |
60 | GNUNET_CONNECTION_notify_transmit_ready (csock, | 60 | GNUNET_CONNECTION_notify_transmit_ready (csock, |
diff --git a/src/util/test_connection_transmit_cancel.c b/src/util/test_connection_transmit_cancel.c index b801e1b68..37a513e0f 100644 --- a/src/util/test_connection_transmit_cancel.c +++ b/src/util/test_connection_transmit_cancel.c | |||
@@ -51,7 +51,7 @@ task_transmit_cancel (void *cls, | |||
51 | struct GNUNET_CONNECTION_Handle *csock; | 51 | struct GNUNET_CONNECTION_Handle *csock; |
52 | 52 | ||
53 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, | 53 | csock = GNUNET_CONNECTION_create_from_connect (tc->sched, cfg, |
54 | "localhost", PORT, 1024); | 54 | "localhost", PORT); |
55 | GNUNET_assert (csock != NULL); | 55 | GNUNET_assert (csock != NULL); |
56 | th = GNUNET_CONNECTION_notify_transmit_ready (csock, | 56 | th = GNUNET_CONNECTION_notify_transmit_ready (csock, |
57 | 12, | 57 | 12, |
diff --git a/src/util/test_server.c b/src/util/test_server.c index 8fa329f5f..78e2d52bf 100644 --- a/src/util/test_server.c +++ b/src/util/test_server.c | |||
@@ -95,7 +95,7 @@ reply_msg (void *cls, size_t size, void *buf) | |||
95 | 95 | ||
96 | GNUNET_assert (ok == 3); | 96 | GNUNET_assert (ok == 3); |
97 | ok = 4; | 97 | ok = 4; |
98 | GNUNET_assert (size > sizeof (struct GNUNET_MessageHeader)); | 98 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
99 | msg.type = htons (MY_TYPE); | 99 | msg.type = htons (MY_TYPE); |
100 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 100 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
101 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); | 101 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); |
@@ -137,7 +137,7 @@ transmit_second_message (void *cls, | |||
137 | { | 137 | { |
138 | struct GNUNET_MessageHeader msg; | 138 | struct GNUNET_MessageHeader msg; |
139 | 139 | ||
140 | GNUNET_assert (size > sizeof (struct GNUNET_MessageHeader)); | 140 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
141 | msg.type = htons (MY_TYPE2); | 141 | msg.type = htons (MY_TYPE2); |
142 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 142 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
143 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); | 143 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); |
@@ -154,7 +154,7 @@ transmit_initial_message (void *cls, | |||
154 | 154 | ||
155 | GNUNET_assert (ok == 1); | 155 | GNUNET_assert (ok == 1); |
156 | ok = 2; | 156 | ok = 2; |
157 | GNUNET_assert (size > sizeof (struct GNUNET_MessageHeader)); | 157 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
158 | msg.type = htons (MY_TYPE); | 158 | msg.type = htons (MY_TYPE); |
159 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 159 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
160 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); | 160 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); |
@@ -193,7 +193,6 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
193 | NULL, | 193 | NULL, |
194 | sap, | 194 | sap, |
195 | slens, | 195 | slens, |
196 | 1024, | ||
197 | TIMEOUT, | 196 | TIMEOUT, |
198 | GNUNET_NO); | 197 | GNUNET_NO); |
199 | GNUNET_assert (server != NULL); | 198 | GNUNET_assert (server != NULL); |
diff --git a/src/util/test_server_disconnect.c b/src/util/test_server_disconnect.c index 049d28667..2fef5642e 100644 --- a/src/util/test_server_disconnect.c +++ b/src/util/test_server_disconnect.c | |||
@@ -115,7 +115,7 @@ transmit_initial_message (void *cls, | |||
115 | 115 | ||
116 | GNUNET_assert (ok == 1); | 116 | GNUNET_assert (ok == 1); |
117 | ok = 2; | 117 | ok = 2; |
118 | GNUNET_assert (size > sizeof (struct GNUNET_MessageHeader)); | 118 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
119 | msg.type = htons (MY_TYPE); | 119 | msg.type = htons (MY_TYPE); |
120 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); | 120 | msg.size = htons (sizeof (struct GNUNET_MessageHeader)); |
121 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); | 121 | memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); |
@@ -146,7 +146,6 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
146 | NULL, | 146 | NULL, |
147 | sap, | 147 | sap, |
148 | slens, | 148 | slens, |
149 | 1024, | ||
150 | TIMEOUT, | 149 | TIMEOUT, |
151 | GNUNET_NO); | 150 | GNUNET_NO); |
152 | GNUNET_assert (server != NULL); | 151 | GNUNET_assert (server != NULL); |
diff --git a/src/util/test_server_with_client.c b/src/util/test_server_with_client.c index 37cfa0a24..4157be250 100644 --- a/src/util/test_server_with_client.c +++ b/src/util/test_server_with_client.c | |||
@@ -179,7 +179,6 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
179 | NULL, | 179 | NULL, |
180 | sap, | 180 | sap, |
181 | slens, | 181 | slens, |
182 | 1024, | ||
183 | GNUNET_TIME_relative_multiply | 182 | GNUNET_TIME_relative_multiply |
184 | (GNUNET_TIME_UNIT_MILLISECONDS, 250), | 183 | (GNUNET_TIME_UNIT_MILLISECONDS, 250), |
185 | GNUNET_NO); | 184 | GNUNET_NO); |