void
GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberTransmitHandle *th)
{
-
+ member_to_origin (th->member);
}
*/
uint8_t state;
+ /**
+ * Whether a message ACK has already been sent to the client.
+ * #GNUNET_YES or #GNUNET_NO
+ */
+ uint8_t ack_sent;
+
/* Followed by message */
};
};
-static inline void
+static void
transmit_message (struct Channel *chn);
memcpy (data, &tmit_msg[1], *data_size);
int ret = (MSG_STATE_END < chn->tmit_state) ? GNUNET_NO : GNUNET_YES;
- if (NULL != tmit_msg->client)
+
+ if (NULL != tmit_msg->client && GNUNET_NO == tmit_msg->ack_sent)
send_message_ack (chn, tmit_msg->client);
GNUNET_CONTAINER_DLL_remove (chn->tmit_head, chn->tmit_tail, tmit_msg);
}
-static inline void
+static void
transmit_message (struct Channel *chn)
{
chn->is_master
* @param first_ptype First message part type in @a data.
* @param last_ptype Last message part type in @a data.
*/
-static void
+static struct TransmitMessage *
queue_message (struct Channel *chn,
struct GNUNET_SERVER_Client *client,
size_t data_size,
first_ptype, last_ptype)
: slave_queue_message ((struct Slave *) chn, tmit_msg,
first_ptype, last_ptype);
+ return tmit_msg;
}
queue_message (chn, client, size - sizeof (*msg), &msg[1],
first_ptype, last_ptype);
transmit_message (chn);
+ /* FIXME: send a few ACKs even before transmit_notify is called */
GNUNET_SERVER_receive_done (client, GNUNET_OK);
};
struct FragmentTransmitQueue *tmit_frag)
{
uint16_t psize = ntohs (tmit_frag->next_part->size);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%p psyc_transmit_queue_next_part: %x + %u - %x = %u < %u\n",
- plc, tmit_frag->next_part, psize, &tmit_frag[1],
- (char *) tmit_frag->next_part + psize - ((char *) &tmit_frag[1]),
- tmit_frag->size);
if ((char *) tmit_frag->next_part + psize - ((char *) &tmit_frag[1])
< tmit_frag->size)
{
break;
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
- case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
*data_size = 0;
ret = GNUNET_YES;
break;
+ case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
+ *data_size = 0;
+ ret = GNUNET_SYSERR;
+ break;
+
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"%p psyc_transmit_notify_data: unexpected message part of type %u.\n",
ret = GNUNET_SYSERR;
}
- if (GNUNET_SYSERR == ret)
+ if (GNUNET_SYSERR == ret && GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL != ptype)
{
*data_size = 0;
tmit_msg = psyc_transmit_queue_next_msg (plc, tmit_msg);
}
else
{
- psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
+ tmit_frag = psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
+ if (NULL != tmit_frag)
+ {
+ struct GNUNET_MessageHeader *pmsg = tmit_frag->next_part;
+ ptype = ntohs (pmsg->type);
+ switch (ptype)
+ {
+ case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
+ ret = GNUNET_YES;
+ break;
+ case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
+ ret = GNUNET_SYSERR;
+ break;
+ }
+ switch (ptype)
+ {
+ case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
+ case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
+ tmit_frag = psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
+ }
+ }
if (NULL == tmit_msg->frags_head
&& GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END <= ptype)
*data_size = mod_size;
memcpy (data, &pmod[1], mod_size);
ret = GNUNET_NO;
-#if REMOVE // FIXME
- ret = (mod_size - strnlen ((char *) &pmod[1], mod_size) - 1
- == *full_value_size)
- ? GNUNET_YES
- : GNUNET_NO;
-#endif
break;
}
}
else
{
- psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
+ if (GNUNET_YES != ret)
+ psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
if (NULL == tmit_msg->frags_head
&& GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END <= ptype)
uint16_t psize = ntohs (pmsg->size);
*pmeth = (struct GNUNET_PSYC_MessageMethod *) pmsg;
-
if (psize < sizeof (**pmeth) + 1 || '\0' != *((char *) *pmeth + psize - 1))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
GNUNET_break (0);
return GNUNET_SYSERR;
}
+
psyc_transmit_queue_next_part (plc, tmit_msg, tmit_frag);
return GNUNET_OK;
}
* otherwise handle to cancel the request.
*/
struct GNUNET_SOCIAL_TalkRequest *
-GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *guest,
+GNUNET_SOCIAL_guest_talk (struct GNUNET_SOCIAL_Guest *gst,
const char *method_name,
const struct GNUNET_ENV_Environment *env,
GNUNET_PSYC_TransmitNotifyData notify_data,
void *notify_data_cls,
enum GNUNET_SOCIAL_TalkFlags flags)
{
- return NULL;
+ if (GNUNET_OK ==
+ GNUNET_PSYC_transmit_message (gst->plc.tmit, method_name, env,
+ NULL, notify_data, notify_data_cls, flags));
+ return (struct GNUNET_SOCIAL_TalkRequest *) gst->plc.tmit;
}
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-#define DEBUG_SERVICE 0
+#define DEBUG_SERVICE 1
#define DATA2ARG(data) data, sizeof (data)
/**
TEST_HOST_ANNOUNCE = 5,
TEST_HOST_ANNOUNCE_END = 6,
TEST_GUEST_TALK = 7,
- TEST_GUEST_TALK_END = 8,
- TEST_GUEST_LEAVE = 9,
- TEST_HOST_LEAVE = 10,
+ TEST_GUEST_LEAVE = 8,
+ TEST_HOST_LEAVE = 9,
} test;
size_t variable_count,
struct GNUNET_ENV_Modifier *variables)
{
+ // FIXME: this function is not called yet
+
struct GNUNET_CRYPTO_EcdsaPublicKey *
nym_key = GNUNET_SOCIAL_nym_get_key (nym);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
void
-schedule_guest_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+guest_leave()
{
test = TEST_GUEST_LEAVE;
/* FIXME test keep_active */
guest_talk ();
break;
- case TEST_GUEST_TALK:
- test = TEST_GUEST_TALK_END;
- break;
-
- case TEST_GUEST_TALK_END:
- GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL);
- break;
-
default:
GNUNET_assert (0);
}
break;
case TEST_GUEST_TALK:
- test = TEST_GUEST_TALK_END;
- break;
-
- case TEST_GUEST_TALK_END:
- GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL);
+ guest_leave ();
break;
default:
tmit.data[2] = "testing ten nine eight";
tmit.data_count = 3;
- tmit.host_ann
- = GNUNET_SOCIAL_host_announce (hst, "_message_guest", tmit.env,
- ¬ify_data, &tmit,
- GNUNET_SOCIAL_TALK_NONE);
+ tmit.guest_talk
+ = GNUNET_SOCIAL_guest_talk (gst, "_message_guest", tmit.env,
+ ¬ify_data, &tmit,
+ GNUNET_SOCIAL_TALK_NONE);
}
void