Esempio n. 1
0
Flow* createFlow(Packet* p, bool virtual_f)
{
	Flow* f = flow_create(p);
	if (virtual_f == TRUE)
		heap_push(virtual_flows, f);
	else
		heap_push(flows, f);
	
	return f;
}
Esempio n. 2
0
static int send_flow(SESSION_INSTANCE* session)
{
	int result;
	if (session == NULL)
	{
		result = __LINE__;
	}
	else
	{
		FLOW_HANDLE flow = flow_create(session->incoming_window, session->next_outgoing_id, session->outgoing_window);

		if (flow == NULL)
		{
			result = __LINE__;
		}
		else
		{
			if (flow_set_next_incoming_id(flow, session->next_incoming_id) != 0)
			{
				result = __LINE__;
			}
			else
			{
				AMQP_VALUE flow_performative_value = amqpvalue_create_flow(flow);
				if (flow_performative_value == NULL)
				{
					result = __LINE__;
				}
				else
				{
					if (connection_encode_frame(session->endpoint, flow_performative_value, NULL, 0, NULL, NULL) != 0)
					{
						result = __LINE__;
					}
					else
					{
						result = 0;
					}

					amqpvalue_destroy(flow_performative_value);
				}
			}

			flow_destroy(flow);
		}
	}

	return result;
}