- "receive_ready read %u/%u bytes from `%s' (%p)!\n", (unsigned int) ret,
- sh->max, GNUNET_a2s (sh->addr, sh->addrlen), sh);
- GNUNET_assert (NULL != (receiver = sh->receiver));
- sh->receiver = NULL;
- receiver (sh->receiver_cls, buffer, ret, sh->addr, sh->addrlen, 0);
-}
-
-
-/**
- * This function is called after establishing a connection either has
- * succeeded or timed out. Note that it is possible that the attempt
- * timed out and that we're immediately retrying. If we are retrying,
- * we need to wait again (or timeout); if we succeeded, we need to
- * wait for data (or timeout).
- *
- * @param cls our connection handle
- * @param tc task context describing why we are here
- */
-static void
-receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct GNUNET_CONNECTION_Handle *sh = cls;
- struct GNUNET_TIME_Absolute now;
-
- sh->read_task = GNUNET_SCHEDULER_NO_TASK;
- if (sh->sock == NULL)
- {
- /* not connected and no longer trying */
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receive encounters error, socket closed (%p)...\n", sh);
- signal_error (sh, ECONNREFUSED);
- return;
- }
- now = GNUNET_TIME_absolute_get ();
- if ((now.abs_value > sh->receive_timeout.abs_value) ||
- (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receive encounters error: time out (%p)...\n", sh);
- signal_timeout (sh);
- return;
- }
- GNUNET_assert (sh->sock != NULL);
- /* connect succeeded, wait for data! */
- sh->read_task =
- GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining
- (sh->receive_timeout), sh->sock,
- &receive_ready, sh);
+ "receive_ready read %u/%u bytes from `%s' (%p)!\n",
+ (unsigned int) ret,
+ connection->max,
+ GNUNET_a2s (connection->addr,
+ connection->addrlen),
+ connection);
+ GNUNET_assert (NULL != (receiver = connection->receiver));
+ connection->receiver = NULL;
+ receiver (connection->receiver_cls,
+ buffer,
+ ret,
+ connection->addr,
+ connection->addrlen,
+ 0);