aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/gnunet-service-scalarproduct_bob.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-07 22:54:20 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-07 22:54:20 +0000
commit840ea5278ccb38427c76c6c14682664c643150f9 (patch)
tree7d26fd458b794bc971857710914740dffd9505cb /src/scalarproduct/gnunet-service-scalarproduct_bob.c
parent629a4960f97c50422770c1267aeddb175b8b89a7 (diff)
downloadgnunet-840ea5278ccb38427c76c6c14682664c643150f9.tar.gz
gnunet-840ea5278ccb38427c76c6c14682664c643150f9.zip
-style, actually call GNUNET_CADET_receive_done to receive more messages
Diffstat (limited to 'src/scalarproduct/gnunet-service-scalarproduct_bob.c')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index 8f946f7a3..fc0fd5bb3 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@ -175,9 +175,12 @@ struct BobServiceSession
175 uint32_t cadet_transmitted_element_count; 175 uint32_t cadet_transmitted_element_count;
176 176
177 /** 177 /**
178 * Is this session active (#GNUNET_YES), Concluded (#GNUNET_NO), or had an error (#GNUNET_SYSERR) 178 * State of this session. In
179 * #GNUNET_SCALARPRODUCT_STATUS_ACTIVE while operation is
180 * ongoing, afterwards in #GNUNET_SCALARPRODUCT_STATUS_SUCCESS or
181 * #GNUNET_SCALARPRODUCT_STATUS_FAILURE.
179 */ 182 */
180 int32_t active; 183 enum GNUNET_SCALARPRODUCT_ResponseStatus status;
181 184
182 /** 185 /**
183 * Are we already in #destroy_service_session()? 186 * Are we already in #destroy_service_session()?
@@ -448,13 +451,13 @@ prepare_client_end_notification (struct BobServiceSession *session)
448 451
449 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 452 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
450 "Sending session-end notification with status %d to client for session %s\n", 453 "Sending session-end notification with status %d to client for session %s\n",
451 session->active, 454 session->status,
452 GNUNET_h2s (&session->session_id)); 455 GNUNET_h2s (&session->session_id));
453 e = GNUNET_MQ_msg (msg, 456 e = GNUNET_MQ_msg (msg,
454 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT); 457 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT);
455 msg->range = 0; 458 msg->range = 0;
456 msg->product_length = htonl (0); 459 msg->product_length = htonl (0);
457 msg->status = htonl (session->active); 460 msg->status = htonl (session->status);
458 GNUNET_MQ_send (session->client_mq, 461 GNUNET_MQ_send (session->client_mq,
459 e); 462 e);
460} 463}
@@ -483,12 +486,17 @@ cb_channel_destruction (void *cls,
483 "Peer disconnected, terminating session %s with peer %s\n", 486 "Peer disconnected, terminating session %s with peer %s\n",
484 GNUNET_h2s (&in->session_id), 487 GNUNET_h2s (&in->session_id),
485 GNUNET_i2s (&in->peer)); 488 GNUNET_i2s (&in->peer));
489 if (NULL != in->cadet_mq)
490 {
491 GNUNET_MQ_destroy (in->cadet_mq);
492 in->cadet_mq = NULL;
493 }
486 in->channel = NULL; 494 in->channel = NULL;
487 if (NULL != (s = in->s)) 495 if (NULL != (s = in->s))
488 { 496 {
489 if (GNUNET_YES == s->active) 497 if (GNUNET_SCALARPRODUCT_STATUS_ACTIVE == s->status)
490 { 498 {
491 s->active = GNUNET_SYSERR; 499 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
492 prepare_client_end_notification (s); 500 prepare_client_end_notification (s);
493 } 501 }
494 } 502 }
@@ -505,7 +513,7 @@ bob_cadet_done_cb (void *cls)
505{ 513{
506 struct BobServiceSession *session = cls; 514 struct BobServiceSession *session = cls;
507 515
508 session->active = GNUNET_NO; /* that means, done */ 516 session->status = GNUNET_SCALARPRODUCT_STATUS_SUCCESS;
509 prepare_client_end_notification (session); 517 prepare_client_end_notification (session);
510} 518}
511 519
@@ -944,6 +952,7 @@ handle_alices_cryptodata_message (void *cls,
944 CADET response(s) */ 952 CADET response(s) */
945 transmit_cryptographic_reply (s); 953 transmit_cryptographic_reply (s);
946 } 954 }
955 GNUNET_CADET_receive_done (s->cadet->channel);
947 return GNUNET_OK; 956 return GNUNET_OK;
948} 957}
949 958
@@ -984,6 +993,7 @@ cb_intersection_element_removed (void *cls,
984 case GNUNET_SET_STATUS_DONE: 993 case GNUNET_SET_STATUS_DONE:
985 s->intersection_op = NULL; 994 s->intersection_op = NULL;
986 s->intersection_set = NULL; 995 s->intersection_set = NULL;
996 GNUNET_CADET_receive_done (s->cadet->channel);
987 LOG (GNUNET_ERROR_TYPE_DEBUG, 997 LOG (GNUNET_ERROR_TYPE_DEBUG,
988 "Finished intersection, %d items remain\n", 998 "Finished intersection, %d items remain\n",
989 GNUNET_CONTAINER_multihashmap_size (s->intersected_elements)); 999 GNUNET_CONTAINER_multihashmap_size (s->intersected_elements));
@@ -1005,7 +1015,7 @@ cb_intersection_element_removed (void *cls,
1005 "Set intersection failed!\n"); 1015 "Set intersection failed!\n");
1006 s->intersection_op = NULL; 1016 s->intersection_op = NULL;
1007 s->intersection_set = NULL; 1017 s->intersection_set = NULL;
1008 s->active = GNUNET_SYSERR; 1018 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
1009 prepare_client_end_notification (s); 1019 prepare_client_end_notification (s);
1010 return; 1020 return;
1011 default: 1021 default:
@@ -1297,7 +1307,7 @@ GSS_handle_bob_client_message (void *cls,
1297 } 1307 }
1298 1308
1299 s = GNUNET_new (struct BobServiceSession); 1309 s = GNUNET_new (struct BobServiceSession);
1300 s->active = GNUNET_YES; 1310 s->status = GNUNET_SCALARPRODUCT_STATUS_ACTIVE;
1301 s->client = client; 1311 s->client = client;
1302 s->client_mq = GNUNET_MQ_queue_for_server_client (client); 1312 s->client_mq = GNUNET_MQ_queue_for_server_client (client);
1303 s->total = total_count; 1313 s->total = total_count;