aboutsummaryrefslogtreecommitdiff
path: root/src/util/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/connection.c')
-rw-r--r--src/util/connection.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/util/connection.c b/src/util/connection.c
index 5aa277546..b3ea3b5af 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -606,10 +606,9 @@ connect_fail_continuation (struct GNUNET_CONNECTION_Handle *connection)
606 * We are ready to transmit (or got a timeout). 606 * We are ready to transmit (or got a timeout).
607 * 607 *
608 * @param cls our connection handle 608 * @param cls our connection handle
609 * @param tc task context describing why we are here
610 */ 609 */
611static void 610static void
612transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 611transmit_ready (void *cls);
613 612
614 613
615/** 614/**
@@ -617,10 +616,9 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
617 * to read. 616 * to read.
618 * 617 *
619 * @param cls connection to read from 618 * @param cls connection to read from
620 * @param tc scheduler context
621 */ 619 */
622static void 620static void
623receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 621receive_ready (void *cls);
624 622
625 623
626/** 624/**
@@ -668,15 +666,14 @@ connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection)
668 * Scheduler let us know that we're either ready to write on the 666 * Scheduler let us know that we're either ready to write on the
669 * socket OR connect timed out. Do the right thing. 667 * socket OR connect timed out. Do the right thing.
670 * 668 *
671 * @param cls the "struct AddressProbe*" with the address that we are probing 669 * @param cls the `struct AddressProbe *` with the address that we are probing
672 * @param tc success or failure info about the connect attempt.
673 */ 670 */
674static void 671static void
675connect_probe_continuation (void *cls, 672connect_probe_continuation (void *cls)
676 const struct GNUNET_SCHEDULER_TaskContext *tc)
677{ 673{
678 struct AddressProbe *ap = cls; 674 struct AddressProbe *ap = cls;
679 struct GNUNET_CONNECTION_Handle *connection = ap->connection; 675 struct GNUNET_CONNECTION_Handle *connection = ap->connection;
676 const struct GNUNET_SCHEDULER_TaskContext *tc;
680 struct AddressProbe *pos; 677 struct AddressProbe *pos;
681 int error; 678 int error;
682 socklen_t len; 679 socklen_t len;
@@ -686,6 +683,7 @@ connect_probe_continuation (void *cls,
686 len = sizeof (error); 683 len = sizeof (error);
687 errno = 0; 684 errno = 0;
688 error = 0; 685 error = 0;
686 tc = GNUNET_SCHEDULER_get_task_context ();
689 if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) || 687 if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) ||
690 (GNUNET_OK != 688 (GNUNET_OK !=
691 GNUNET_NETWORK_socket_getsockopt (ap->sock, SOL_SOCKET, SO_ERROR, &error, 689 GNUNET_NETWORK_socket_getsockopt (ap->sock, SOL_SOCKET, SO_ERROR, &error,
@@ -1095,18 +1093,18 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection)
1095 * or have data ready to read. 1093 * or have data ready to read.
1096 * 1094 *
1097 * @param cls connection to read from 1095 * @param cls connection to read from
1098 * @param tc scheduler context
1099 */ 1096 */
1100static void 1097static void
1101receive_ready (void *cls, 1098receive_ready (void *cls)
1102 const struct GNUNET_SCHEDULER_TaskContext *tc)
1103{ 1099{
1104 struct GNUNET_CONNECTION_Handle *connection = cls; 1100 struct GNUNET_CONNECTION_Handle *connection = cls;
1101 const struct GNUNET_SCHEDULER_TaskContext *tc;
1105 char buffer[connection->max]; 1102 char buffer[connection->max];
1106 ssize_t ret; 1103 ssize_t ret;
1107 GNUNET_CONNECTION_Receiver receiver; 1104 GNUNET_CONNECTION_Receiver receiver;
1108 1105
1109 connection->read_task = NULL; 1106 connection->read_task = NULL;
1107 tc = GNUNET_SCHEDULER_get_task_context ();
1110 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1108 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1111 { 1109 {
1112 /* ignore shutdown request, go again immediately */ 1110 /* ignore shutdown request, go again immediately */
@@ -1296,11 +1294,9 @@ process_notify (struct GNUNET_CONNECTION_Handle *connection)
1296 * This task notifies the client about the timeout. 1294 * This task notifies the client about the timeout.
1297 * 1295 *
1298 * @param cls the `struct GNUNET_CONNECTION_Handle` 1296 * @param cls the `struct GNUNET_CONNECTION_Handle`
1299 * @param tc scheduler context
1300 */ 1297 */
1301static void 1298static void
1302transmit_timeout (void *cls, 1299transmit_timeout (void *cls)
1303 const struct GNUNET_SCHEDULER_TaskContext *tc)
1304{ 1300{
1305 struct GNUNET_CONNECTION_Handle *connection = cls; 1301 struct GNUNET_CONNECTION_Handle *connection = cls;
1306 GNUNET_CONNECTION_TransmitReadyNotify notify; 1302 GNUNET_CONNECTION_TransmitReadyNotify notify;
@@ -1327,11 +1323,9 @@ transmit_timeout (void *cls,
1327 * This task notifies the client about the error. 1323 * This task notifies the client about the error.
1328 * 1324 *
1329 * @param cls the `struct GNUNET_CONNECTION_Handle` 1325 * @param cls the `struct GNUNET_CONNECTION_Handle`
1330 * @param tc scheduler context
1331 */ 1326 */
1332static void 1327static void
1333connect_error (void *cls, 1328connect_error (void *cls)
1334 const struct GNUNET_SCHEDULER_TaskContext *tc)
1335{ 1329{
1336 struct GNUNET_CONNECTION_Handle *connection = cls; 1330 struct GNUNET_CONNECTION_Handle *connection = cls;
1337 GNUNET_CONNECTION_TransmitReadyNotify notify; 1331 GNUNET_CONNECTION_TransmitReadyNotify notify;
@@ -1353,14 +1347,13 @@ connect_error (void *cls,
1353 * We are ready to transmit (or got a timeout). 1347 * We are ready to transmit (or got a timeout).
1354 * 1348 *
1355 * @param cls our connection handle 1349 * @param cls our connection handle
1356 * @param tc task context describing why we are here
1357 */ 1350 */
1358static void 1351static void
1359transmit_ready (void *cls, 1352transmit_ready (void *cls)
1360 const struct GNUNET_SCHEDULER_TaskContext *tc)
1361{ 1353{
1362 struct GNUNET_CONNECTION_Handle *connection = cls; 1354 struct GNUNET_CONNECTION_Handle *connection = cls;
1363 GNUNET_CONNECTION_TransmitReadyNotify notify; 1355 GNUNET_CONNECTION_TransmitReadyNotify notify;
1356 const struct GNUNET_SCHEDULER_TaskContext *tc;
1364 ssize_t ret; 1357 ssize_t ret;
1365 size_t have; 1358 size_t have;
1366 1359
@@ -1370,6 +1363,7 @@ transmit_ready (void *cls,
1370 GNUNET_assert (NULL != connection->write_task); 1363 GNUNET_assert (NULL != connection->write_task);
1371 connection->write_task = NULL; 1364 connection->write_task = NULL;
1372 GNUNET_assert (NULL == connection->nth.timeout_task); 1365 GNUNET_assert (NULL == connection->nth.timeout_task);
1366 tc = GNUNET_SCHEDULER_get_task_context ();
1373 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1367 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1374 { 1368 {
1375 if (NULL != connection->sock) 1369 if (NULL != connection->sock)