* @param timeout maximum amount of time to wait
* @param receiver function to call with received data
* @param receiver_cls closure for @a receiver
+ * @return #GNUNET_SYSERR if @a connection died (receiver was
+ * called with error)
*/
-void
+int
GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection,
size_t max,
struct GNUNET_TIME_Relative timeout,
connection->sock,
&receive_ready,
connection);
- return;
+ return GNUNET_OK;
}
if ((NULL == connection->dns_active) &&
(NULL == connection->ap_head) &&
NULL, 0,
NULL, 0,
ETIMEDOUT);
- return;
+ return GNUNET_SYSERR;
}
+ return GNUNET_OK;
}
"Server re-enters receive loop, timeout: %s.\n",
GNUNET_STRINGS_relative_time_to_string (client->idle_timeout, GNUNET_YES));
client->receive_pending = GNUNET_YES;
- GNUNET_CONNECTION_receive (client->connection,
- GNUNET_MAX_MESSAGE_SIZE - 1,
- client->idle_timeout,
- &process_incoming,
- client);
+ if (GNUNET_OK !=
+ GNUNET_CONNECTION_receive (client->connection,
+ GNUNET_MAX_MESSAGE_SIZE - 1,
+ client->idle_timeout,
+ &process_incoming,
+ client))
+ return;
break;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
for (n = server->connect_notify_list_head; NULL != n; n = n->next)
n->callback (n->callback_cls, client);
client->receive_pending = GNUNET_YES;
- GNUNET_CONNECTION_receive (client->connection,
- GNUNET_MAX_MESSAGE_SIZE - 1,
- client->idle_timeout,
- &process_incoming,
- client);
+ if (GNUNET_SYSERR ==
+ GNUNET_CONNECTION_receive (client->connection,
+ GNUNET_MAX_MESSAGE_SIZE - 1,
+ client->idle_timeout,
+ &process_incoming,
+ client))
+ return NULL;
return client;
}