/*
This file is part of GNUnet.
- (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013, 2014 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file scalarproduct/gnunet-service-scalarproduct_bob.c
*/
struct CadetIncomingSession *cadet;
- /**
- * The computed scalar
- */
- gcry_mpi_t product;
-
/**
* How many elements will be supplied in total from the client.
*/
GNUNET_free (s->r_prime);
s->r_prime = NULL;
}
- if (NULL != s->product)
- {
- gcry_mpi_release (s->product);
- s->product = NULL;
- }
GNUNET_free (s);
}
struct ClientResponseMessage *msg;
struct GNUNET_MQ_Envelope *e;
+ if (NULL == session->client_mq)
+ return; /* no client left to be notified */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending session-end notification with status %d to client for session %s\n",
session->status,
"Peer disconnected, terminating session %s with peer %s\n",
GNUNET_h2s (&in->session_id),
GNUNET_i2s (&in->peer));
- if (NULL != in->cadet_mq)
- {
- GNUNET_MQ_destroy (in->cadet_mq);
- in->cadet_mq = NULL;
- }
- in->channel = NULL;
if (NULL != (s = in->s))
{
if (GNUNET_SCALARPRODUCT_STATUS_ACTIVE == s->status)
prepare_client_end_notification (s);
}
}
+ if (NULL != in->cadet_mq)
+ {
+ GNUNET_MQ_destroy (in->cadet_mq);
+ in->cadet_mq = NULL;
+ }
+ in->channel = NULL;
destroy_cadet_session (in);
}
&r[i]))
{
GNUNET_break_op (0);
- return GNUNET_SYSERR;
+ goto error_cleanup;
}
}
&r_prime[i]))
{
GNUNET_break_op (0);
- return GNUNET_SYSERR;
+ goto error_cleanup;
}
}
gcry_mpi_release (tmp);
session->r = r;
session->r_prime = r_prime;
- // release rand, b and a
for (i = 0; i < count; i++)
gcry_mpi_release (rand[i]);
GNUNET_free (session->e_a);
GNUNET_free (q);
GNUNET_free (rand);
return GNUNET_OK;
+
+ error_cleanup:
+ GNUNET_free (r);
+ GNUNET_free (r_prime);
+ gcry_mpi_release (tmp);
+ GNUNET_free (p);
+ GNUNET_free (q);
+ for (i = 0; i < count; i++)
+ gcry_mpi_release (rand[i]);
+ GNUNET_free (rand);
+ return GNUNET_SYSERR;
}
struct BobServiceSession *s;
const struct ServiceRequestMessage *msg;
- if (ntohs (message->size) != sizeof (struct ServiceRequestMessage))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
msg = (const struct ServiceRequestMessage *) message;
if (GNUNET_YES == in->in_map)
{
elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1];
for (i = 0; i < contained_count; i++)
{
- if (0 == GNUNET_ntohll (elements[i].value))
- continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
memcpy (elem,
&elements[i],
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
if (NULL == client)
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Client disconnected from us.\n",
- client);
+ "Client disconnected from us.\n");
s = GNUNET_SERVER_client_get_user_context (client,
struct BobServiceSession);
if (NULL == s)
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+ NULL);
}