[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29298 - gnunet/src/scalarproduct
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29298 - gnunet/src/scalarproduct |
Date: |
Mon, 16 Sep 2013 14:13:13 +0200 |
Author: cfuchs
Date: 2013-09-16 14:13:13 +0200 (Mon, 16 Sep 2013)
New Revision: 29298
Modified:
gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
gnunet/src/scalarproduct/scalarproduct_api.c
Log:
SP-client now reads the result from the correct offset (msg vs. message...)
upon shutdown, the server-API no longer crashes the SP-service by calling the
client-disconnect handler with a &client == NULL
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-09-16
11:54:42 UTC (rev 29297)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-09-16
12:13:13 UTC (rev 29298)
@@ -682,6 +682,8 @@
{
struct ServiceSession *session;
+ if (client == NULL)
+ return;
session = GNUNET_SERVER_client_get_user_context (client, struct
ServiceSession);
if (NULL == session)
return;
@@ -740,9 +742,9 @@
memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode));
memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity));
msg->header.size = htons (sizeof (struct
GNUNET_SCALARPRODUCT_client_response));
- // 0 size and the first char in the product is 0, which should never be zero
if encoding is used.
+ // signal error if not signalized, positive result-range field but zero
length.
msg->product_length = htonl (0);
- msg->range = 1;
+ msg->range = (session->state == FINALIZED)? 0 : -1;
session->msg = &msg->header;
@@ -883,7 +885,6 @@
msg_length,
&do_send_message,
request);
- // we don't care if it could be send or not. either way, the session is
over for us.
request->state = FINALIZED;
}
else
@@ -893,7 +894,7 @@
if ( NULL == request->service_transmit_handle)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Could not send service-response
message via mesh!)\n"));
-
+
response->client_notification_task =
GNUNET_SCHEDULER_add_now (&prepare_client_end_notification,
response);
@@ -1493,7 +1494,6 @@
}
}
else { //(BOB == session->role) service session
-
// remove the session, unless it has already been dequeued, but somehow
still active
// this could bug without the IF in case the queue is empty and the
service session was the only one know to the service
// scenario: disconnect before alice can send her message to bob.
@@ -1515,6 +1515,7 @@
// or if it was a responder, no point in adding more statefulness
if (client_session && (!do_shutdown))
{
+ client_session->state = FINALIZED;
client_session->client_notification_task =
GNUNET_SCHEDULER_add_now (&prepare_client_end_notification,
client_session);
@@ -1657,7 +1658,7 @@
// get representation as string
if (range
- && (0 != (rc = gcry_mpi_aprint (GCRYMPI_FMT_USG,
+ && (0 != (rc = gcry_mpi_aprint (GCRYMPI_FMT_STD,
&product_exported,
&product_length,
value)))){
@@ -2054,6 +2055,10 @@
GNUNET_SCHEDULER_cancel (session->service_request_task);
session->service_request_task = GNUNET_SCHEDULER_NO_TASK;
}
+ if (NULL != session->client){
+ GNUNET_SERVER_client_disconnect(session->client);
+ session->client = NULL;
+ }
}
for (session = from_service_head; NULL != session; session = session->next)
Modified: gnunet/src/scalarproduct/scalarproduct_api.c
===================================================================
--- gnunet/src/scalarproduct/scalarproduct_api.c 2013-09-16 11:54:42 UTC
(rev 29297)
+++ gnunet/src/scalarproduct/scalarproduct_api.c 2013-09-16 12:13:13 UTC
(rev 29298)
@@ -190,7 +190,7 @@
gcry_mpi_t num;
size_t read = 0;
- if (0 != (rc = gcry_mpi_scan (&num, GCRYMPI_FMT_USG, &msg[1],
product_len, &read)))
+ if (0 != (rc = gcry_mpi_scan (&num, GCRYMPI_FMT_STD, &message[1],
product_len, &read)))
{
LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);
gcry_mpi_release (result);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29298 - gnunet/src/scalarproduct,
gnunet <=