[DEBUG] correct sendig of data (now must generize the multiple send data

This commit is contained in:
Edouard DUPIN 2016-06-22 23:35:10 +02:00
parent ae7d28552a
commit 19948e45f0
2 changed files with 28 additions and 9 deletions

View File

@ -296,7 +296,7 @@ void zeus::Buffer::internalAddParameter<bool>(uint16_t _paramId, const bool& _va
}
m_parameter.push_back(std::make_pair(2,data));
}
#define ZEUS_MINIMUM_SIZE_MULTIPLE (1024*40)
#define ZEUS_MINIMUM_SIZE_MULTIPLE (1024*50)
namespace zeus {
class SendData {

View File

@ -76,6 +76,33 @@ void zeus::GateWayClient::onClientData(const ememory::SharedPtr<zeus::Buffer>& _
answerProtocolError(transactionId, "missing parameter: 'id'");
return;
}
if (_value->getType() == zeus::Buffer::typeMessage::data) {
// TRANSMIT DATA ...
if (m_state != zeus::GateWayClient::state::clientIdentify) {
answerProtocolError(transactionId, "Not identify to send 'data' buffer (multiple packet element)");
return;
}
uint32_t serviceId = _value->getServiceId();
if (serviceId == 0) {
answerProtocolError(transactionId, "Can not send multiple data on the gateway");
return;
}
serviceId--;
if (serviceId >= m_listConnectedService.size()) {
m_interfaceClient.answerError(transactionId, "NOT-CONNECTED-SERVICE");
return;
}
if (m_listConnectedService[serviceId] == nullptr) {
// TODO ...
ZEUS_ERROR("TODO : Manage this case ...");
return;
}
m_listConnectedService[serviceId]->m_interfaceClient.callForwardMultiple(
m_uid,
_value,
(uint64_t(m_uid) << 32) + uint64_t(transactionId));
return;
}
if (_value->getType() != zeus::Buffer::typeMessage::call) {
ZEUS_ERROR("Protocol error ==>missing 'call'");
answerProtocolError(transactionId, "missing parameter: 'call' / wrong type 'call'");
@ -294,14 +321,6 @@ void zeus::GateWayClient::onClientData(const ememory::SharedPtr<zeus::Buffer>& _
ZEUS_ERROR("TODO : Manage this case ...");
return;
}
uint16_t partId = _value->getPartId();
if (partId != 0) {
m_listConnectedService[serviceId]->m_interfaceClient.callForwardMultiple(
m_uid,
_value,
(uint64_t(m_uid) << 32) + uint64_t(transactionId));
return;
}
m_listConnectedService[serviceId]->m_interfaceClient.callForward(
m_uid,
_value,