Ejemplo n.º 1
0
void CLocalConnection::SendData(boost::shared_ptr<const RawPacket> data)
{
	if (!ProtocolDef::GetInstance()->IsValidPacket(data->data, data->length)) {
		// having this check here makes it easier to find networking bugs
		// also when testing locally
		logOutput.Print("ERROR: Discarding invalid packet: ID %d, LEN %d",
				(data->length > 0) ? (int)data->data[0] : -1, data->length);
		return;
	}

	dataSent += data->length;
	boost::mutex::scoped_lock scoped_lock(Mutex[OtherInstance()]);
	Data[OtherInstance()].push_back(data);
}
Ejemplo n.º 2
0
void CLocalConnection::SendData(boost::shared_ptr<const RawPacket> packet)
{
	if (!ProtocolDef::GetInstance()->IsValidPacket(packet->data, packet->length)) {
		// having this check here makes it easier to find networking bugs
		// also when testing locally
		LOG_L(L_ERROR, "[%s] discarding invalid packet: ID %d, LEN %d",
			__FUNCTION__, (packet->length > 0) ? (int)packet->data[0] : -1, packet->length);
		return;
	}

	dataSent += packet->length;

	// when sending from A to B we must lock B's queue
	boost::mutex::scoped_lock scoped_lock(mutexes[OtherInstance()]);
	pqueues[OtherInstance()].push_back(packet);
}
Ejemplo n.º 3
0
void CLocalConnection::SendData(boost::shared_ptr<const RawPacket> data)
{
	dataSent += data->length;
	boost::mutex::scoped_lock scoped_lock(Mutex[OtherInstance()]);
	Data[OtherInstance()].push_back(data);
}