Avoid recursive loop if no socket implementations are loaded.

This commit is contained in:
Tobias Brunner
2010-10-14 17:36:20 +02:00
parent 070b63d704
commit c2fad1916a
+13 -2
View File
@@ -274,9 +274,17 @@ static job_requeue_t receive_packets(private_receiver_t *this)
{ {
packet_t *packet; packet_t *packet;
message_t *message; message_t *message;
status_t status;
/* read in a packet */ /* read in a packet */
if (charon->socket->receive(charon->socket, &packet) != SUCCESS) status = charon->socket->receive(charon->socket, &packet);
if (status == NOT_SUPPORTED)
{
/* the processor destroys this job */
this->job = NULL;
return JOB_REQUEUE_NONE;
}
else if (status != SUCCESS)
{ {
DBG2(DBG_NET, "receiving from socket failed!"); DBG2(DBG_NET, "receiving from socket failed!");
return JOB_REQUEUE_FAIR; return JOB_REQUEUE_FAIR;
@@ -368,7 +376,10 @@ static job_requeue_t receive_packets(private_receiver_t *this)
METHOD(receiver_t, destroy, void, METHOD(receiver_t, destroy, void,
private_receiver_t *this) private_receiver_t *this)
{ {
this->job->cancel(this->job); if (this->job)
{
this->job->cancel(this->job);
}
this->rng->destroy(this->rng); this->rng->destroy(this->rng);
this->hasher->destroy(this->hasher); this->hasher->destroy(this->hasher);
free(this); free(this);