Exemplo n.º 1
0
Rrq* REMOTE_find_request(Rrq* request, USHORT level)
{
/**************************************
 *
 *	R E M O T E _ f i n d _ r e q u e s t
 *
 **************************************
 *
 * Functional description
 *	Find sub-request if level is non-zero.
 *
 **************************************/

	// See if we already know about the request level

	for (;;)
	{
		if (request->rrq_level == level)
			return request;
		if (!request->rrq_levels)
			break;
		request = request->rrq_levels;
	}

	// This is a new level -- make up a new request block.

	request->rrq_levels = request->clone();
	// FREE: REMOTE_remove_request()
#ifdef DEBUG_REMOTE_MEMORY
	printf("REMOTE_find_request       allocate request %x\n", request->rrq_levels);
#endif
	request = request->rrq_levels;
	request->rrq_level = level;
	request->rrq_levels = NULL;

	// Allocate message block for known messages

	Rrq::rrq_repeat* tail = request->rrq_rpt.begin();
	const Rrq::rrq_repeat* const end = tail + request->rrq_max_msg;
	for (; tail <= end; tail++)
	{
		const rem_fmt* format = tail->rrq_format;
		if (!format)
			continue;
		RMessage* msg = FB_NEW RMessage(format->fmt_length);
		tail->rrq_xdr = msg;
#ifdef DEBUG_REMOTE_MEMORY
		printf("REMOTE_find_request       allocate message %x\n", msg);
#endif
		msg->msg_next = msg;
		msg->msg_number = tail->rrq_message->msg_number;
		tail->rrq_message = msg;
	}

	return request;
}
Exemplo n.º 2
0
// pubRequest by one of the Satellites, this Server just forwards it by publishing it
bool ReefServer::pubRequest(RMessage& msg){
	msg = RMessage();
	bool retBool;
	std::string tagsStr = s_recv(rep); //receive message tags
	std::string bodyStr = s_recv(rep); //receive messagebody
	CJsonArray tagsArray = jsonToArray(tagsStr); //parse Tags
	tagsInitMessage(msg, tagsArray); //initiate msg with the tags
	tagsArray.Clear();

	retBool = checkInterestAndProcess(msg, bodyStr);
	s_sendmore(publisher, ""); //send empty envelope
	s_sendmore(publisher, tagsStr);	//receive tag-part of message and publish it
	s_send(publisher, bodyStr); //receive body-part of message and publish it
	return retBool;
}