[DEBUG] correct the service video return
This commit is contained in:
parent
feaa41eb15
commit
c5f58d6af6
@ -174,13 +174,11 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZEUS_ERROR("plop ...");
|
|
||||||
Observer callback;
|
Observer callback;
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
callback = m_callbackElse;
|
callback = m_callbackElse;
|
||||||
}
|
}
|
||||||
ZEUS_ERROR("plop .2.");
|
|
||||||
if (callback != nullptr) {
|
if (callback != nullptr) {
|
||||||
bool ret = callback(zeus::FutureBase(sharedFromThis()));
|
bool ret = callback(zeus::FutureBase(sharedFromThis()));
|
||||||
{
|
{
|
||||||
@ -189,7 +187,6 @@ bool zeus::Promise::setMessage(ememory::SharedPtr<zeus::Message> _value) {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ZEUS_ERROR("plop .3.");
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -258,8 +258,8 @@ class SendAsyncBinary {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ZEUS_LOG_INPUT_OUTPUT ZEUS_WARNING
|
//#define ZEUS_LOG_INPUT_OUTPUT ZEUS_WARNING
|
||||||
//#define ZEUS_LOG_INPUT_OUTPUT ZEUS_VERBOSE
|
#define ZEUS_LOG_INPUT_OUTPUT ZEUS_VERBOSE
|
||||||
|
|
||||||
|
|
||||||
int32_t zeus::WebServer::writeBinary(ememory::SharedPtr<zeus::Message> _obj) {
|
int32_t zeus::WebServer::writeBinary(ememory::SharedPtr<zeus::Message> _obj) {
|
||||||
@ -311,7 +311,6 @@ void zeus::WebServer::onReceiveData(std::vector<uint8_t>& _frame, bool _isBinary
|
|||||||
disconnect(true);
|
disconnect(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ZEUS_INFO("receive DATA ... ");
|
|
||||||
ememory::SharedPtr<zeus::Message> dataRaw = zeus::Message::create(sharedFromThis(), _frame);
|
ememory::SharedPtr<zeus::Message> dataRaw = zeus::Message::create(sharedFromThis(), _frame);
|
||||||
if (dataRaw == nullptr) {
|
if (dataRaw == nullptr) {
|
||||||
ZEUS_ERROR("Message Allocation ERROR ... ");
|
ZEUS_ERROR("Message Allocation ERROR ... ");
|
||||||
|
@ -200,7 +200,7 @@ namespace zeus {
|
|||||||
zeus::message::ParamType type = getParameterType(_id);
|
zeus::message::ParamType type = getParameterType(_id);
|
||||||
uint32_t dataSize = getParameterSize(_id);
|
uint32_t dataSize = getParameterSize(_id);
|
||||||
uint8_t* pointer = const_cast<uint8_t*>(getParameterPointer(_id));
|
uint8_t* pointer = const_cast<uint8_t*>(getParameterPointer(_id));
|
||||||
ZEUS_WARNING("get type " << type << " with size=" << dataSize << " pointer=" << uint64_t(pointer) << " sizeof(uint64_t)=" << int32_t(sizeof(uint64_t)));
|
//ZEUS_WARNING("get type " << type << " with size=" << dataSize << " pointer=" << uint64_t(pointer) << " sizeof(uint64_t)=" << int32_t(sizeof(uint64_t)));
|
||||||
// TODO : Check size ...
|
// TODO : Check size ...
|
||||||
if (createType<uint8_t>() == type) {
|
if (createType<uint8_t>() == type) {
|
||||||
uint8_t* tmp = reinterpret_cast<uint8_t*>(pointer);
|
uint8_t* tmp = reinterpret_cast<uint8_t*>(pointer);
|
||||||
|
@ -164,3 +164,42 @@ std::string zeus::storeInFileNotify(zeus::ProxyFile _file, std::string _filename
|
|||||||
return sha512String;
|
return sha512String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint8_t> zeus::storeInMemory(zeus::ProxyFile _file) {
|
||||||
|
std::vector<uint8_t> out;
|
||||||
|
auto futSize = _file.getSize();
|
||||||
|
auto futSha = _file.getSha512();
|
||||||
|
futSize.wait();
|
||||||
|
int64_t retSize = futSize.get();
|
||||||
|
int64_t offset = 0;
|
||||||
|
|
||||||
|
algue::Sha512 shaCtx;
|
||||||
|
out.resize(retSize);
|
||||||
|
int64_t currentOffset = 0;
|
||||||
|
while (retSize > 0) {
|
||||||
|
// get by batch of 1 MB
|
||||||
|
int32_t nbElement = 1*1024*1024;
|
||||||
|
if (retSize<nbElement) {
|
||||||
|
nbElement = retSize;
|
||||||
|
}
|
||||||
|
auto futData = _file.getPart(offset, offset + nbElement);
|
||||||
|
futData.wait();
|
||||||
|
if (futData.hasError() == true) {
|
||||||
|
throw std::runtime_error("Error when loading data");
|
||||||
|
}
|
||||||
|
zeus::Raw buffer = futData.get();
|
||||||
|
shaCtx.update(buffer.data(), buffer.size());
|
||||||
|
memcpy(&out[currentOffset], buffer.data(), buffer.size());
|
||||||
|
currentOffset += buffer.size();
|
||||||
|
offset += nbElement;
|
||||||
|
retSize -= nbElement;
|
||||||
|
ZEUS_VERBOSE("read: " << offset << "/" << futSize.get() << " " << buffer.size());
|
||||||
|
}
|
||||||
|
// get the final sha512 of the file:
|
||||||
|
std::string sha512String = algue::stringConvert(shaCtx.finalize());
|
||||||
|
futSha.wait();
|
||||||
|
if (sha512String != futSha.get()) {
|
||||||
|
ZEUS_ERROR("get wrong Sha512 local : '" << sha512String << "'");
|
||||||
|
ZEUS_ERROR("get wrong Sha512 remote: '" << futSha.get() << "'");
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
@ -62,6 +62,11 @@ raw getPart(uint64, uint64)
|
|||||||
#return:the sha512 of the file (calculated with the input stream.
|
#return:the sha512 of the file (calculated with the input stream.
|
||||||
[tool-remote] string storeInFile(obj:zeus-File, string)
|
[tool-remote] string storeInFile(obj:zeus-File, string)
|
||||||
|
|
||||||
|
#brief:Store all the data in a specific vector of data.
|
||||||
|
#param:file:Handle on the file.
|
||||||
|
#return:buffer of data.
|
||||||
|
[tool-remote] vector:uint8 storeInMemory(obj:zeus-File)
|
||||||
|
|
||||||
#brief:Store all the data in a specific file.
|
#brief:Store all the data in a specific file.
|
||||||
#param:file:Handle on the file.
|
#param:file:Handle on the file.
|
||||||
#param:filename:Local filename.
|
#param:filename:Local filename.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user