aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2014-02-10 18:07:10 +0000
committerFlorian Dold <florian.dold@gmail.com>2014-02-10 18:07:10 +0000
commit7ccabb0a01286623883bd4cb6efcb3adc3b61a23 (patch)
tree30eb716b3f2302b336a69cd957d9de03d41f9261 /src/set
parentc274294a31620fcbd8658ac047ff762a593b28fa (diff)
downloadgnunet-7ccabb0a01286623883bd4cb6efcb3adc3b61a23.tar.gz
gnunet-7ccabb0a01286623883bd4cb6efcb3adc3b61a23.zip
- don't kill clients if the set operation has already been destroyed
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index bb0d2ce18..940401d0a 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -1100,31 +1100,40 @@ handle_client_accept (void *cls,
1100 struct Operation *op; 1100 struct Operation *op;
1101 1101
1102 msg = (const struct GNUNET_SET_AcceptRejectMessage *) mh; 1102 msg = (const struct GNUNET_SET_AcceptRejectMessage *) mh;
1103 op = get_incoming (ntohl (msg->accept_reject_id));
1104 1103
1105 // incoming operation does not exist 1104 // client without a set requested an operation
1106 if (NULL == op) 1105 set = set_get (client);
1106
1107 if (NULL == set)
1107 { 1108 {
1108 GNUNET_break (0); 1109 GNUNET_break (0);
1109 GNUNET_SERVER_client_disconnect (client); 1110 GNUNET_SERVER_client_disconnect (client);
1110 return; 1111 return;
1111 } 1112 }
1112 1113
1114 op = get_incoming (ntohl (msg->accept_reject_id));
1115
1116 /* it is not an error if the set op does not exist -- it may
1117 * have been destroyed when the partner peer disconnected. */
1118 if (NULL == op)
1119 {
1120 struct GNUNET_SET_ResultMessage *result_message;
1121 struct GNUNET_MQ_Envelope *ev;
1122 ev = GNUNET_MQ_msg (result_message, GNUNET_MESSAGE_TYPE_SET_RESULT);
1123 result_message->request_id = msg->request_id;
1124 result_message->element_type = 0;
1125 result_message->result_status = htons (GNUNET_SET_STATUS_FAILURE);
1126 GNUNET_MQ_send (set->client_mq, ev);
1127 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1128 return;
1129 }
1130
1113 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1114 "client accepting %u\n", 1132 "client accepting %u\n",
1115 ntohl (msg->accept_reject_id)); 1133 ntohl (msg->accept_reject_id));
1116 1134
1117 GNUNET_assert (GNUNET_YES == op->is_incoming); 1135 GNUNET_assert (GNUNET_YES == op->is_incoming);
1118 1136
1119 // client without a set requested an operation
1120 set = set_get (client);
1121
1122 if (NULL == set)
1123 {
1124 GNUNET_break (0);
1125 GNUNET_SERVER_client_disconnect (client);
1126 return;
1127 }
1128 1137
1129 op->spec->set = set; 1138 op->spec->set = set;
1130 1139