[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29933 - gnunet/src/scalarproduct
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29933 - gnunet/src/scalarproduct |
Date: |
Mon, 7 Oct 2013 19:10:19 +0200 |
Author: cfuchs
Date: 2013-10-07 19:10:19 +0200 (Mon, 07 Oct 2013)
New Revision: 29933
Modified:
gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
Log:
finished service request multipart message sending
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-10-07
16:49:41 UTC (rev 29932)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2013-10-07
17:10:19 UTC (rev 29933)
@@ -1173,7 +1173,7 @@
struct ServiceSession * session = cls;
unsigned char * current;
unsigned char * element_exported;
- struct GNUNET_SCALARPRODUCT_service_request * msg;
+ struct GNUNET_SCALARPRODUCT_multipart_message * msg;
unsigned int i;
unsigned int j;
uint32_t msg_length;
@@ -1185,12 +1185,15 @@
msg_length = sizeof (struct GNUNET_SCALARPRODUCT_multipart_message);
todo_count = session->used_element_count -
session->transferred_element_count;
- if (todo_count > MULTIPART_ELEMENT_CAPACITY){
- // send the currently possible maximum chunk, else send all remaining
+ if (todo_count > MULTIPART_ELEMENT_CAPACITY)
+ // send the currently possible maximum chunk
todo_count = MULTIPART_ELEMENT_CAPACITY;
- }
+
msg_length += todo_count * PAILLIER_ELEMENT_LENGTH;
msg = GNUNET_malloc (msg_length);
+ msg->header.type = htons
(GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_TO_BOB_MULTIPART);
+ msg->header.size = htons (msg_length);
+ msg->multipart_element_count = htonl (todo_count);
element_exported = GNUNET_malloc (PAILLIER_ELEMENT_LENGTH);
a = gcry_mpi_new (KEYBITS * 2);
@@ -1235,7 +1238,33 @@
}
gcry_mpi_release (a);
GNUNET_free(element_exported);
+ session->transferred_element_count+=todo_count;
+ session->msg = (struct GNUNET_MessageHeader *) msg;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Transmitting service request.\n"));
+
+ //transmit via mesh messaging
+ session->service_transmit_handle = GNUNET_MESH_notify_transmit_ready
(session->tunnel, GNUNET_YES,
+
GNUNET_TIME_UNIT_FOREVER_REL,
+
msg_length,
+
&do_send_message,
+
session);
+ if (!session->service_transmit_handle)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Could not send service-request
multipart message to tunnel!\n"));
+ GNUNET_free (msg);
+ session->msg = NULL;
+ session->client_notification_task =
+ GNUNET_SCHEDULER_add_now (&prepare_client_end_notification,
+ session);
+ return;
+ }
+ if (session->transferred_element_count != session->used_element_count){
+ session->last_processed_element = i;
+ }
+ else
+ //final part
+ session->state = WAITING_FOR_SERVICE_RESPONSE;
}
/**
* Executed by Alice, fills in a service-request message and sends it to the
given peer
@@ -1352,7 +1381,7 @@
session);
if (!session->service_transmit_handle)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Could not send mutlicast message
to tunnel!\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Could not send message to
tunnel!\n"));
GNUNET_free (msg);
session->msg = NULL;
session->client_notification_task =
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29933 - gnunet/src/scalarproduct,
gnunet <=