mirror of
https://github.com/RetroShare/libretroshare.git
synced 2026-09-12 19:50:03 +05:00
This commit is contained in:
parent
bee910a95c
commit
8744a671eb
@ -58,7 +58,8 @@ $%callbackParamsSerialization%$
|
||||
sStream << "data: " << compactJSON << ctx.mJson << "\n\n";
|
||||
const std::string message = sStream.str();
|
||||
|
||||
lService->schedule( [weakSession, message]()
|
||||
auto io_context = lService->get_io_context();
|
||||
asio::post(*io_context, [weakSession, message]()
|
||||
{
|
||||
auto session = weakSession.lock();
|
||||
if(!session || session->is_closed()) return;
|
||||
|
||||
@ -177,7 +177,7 @@ def processFile(file):
|
||||
callbackParams = pType
|
||||
else:
|
||||
pType = pType.replace('&', '').replace(' ', '')
|
||||
|
||||
|
||||
# Apparently some xml declarations include new lines ('\n') and/or multiple spaces
|
||||
# Strip them using python magic
|
||||
pType = ' '.join(pType.split())
|
||||
@ -224,8 +224,8 @@ def processFile(file):
|
||||
|
||||
inputParamsDeserialization = ''
|
||||
if hasInput:
|
||||
inputParamsDeserialization += '\t\t{\n'
|
||||
inputParamsDeserialization += '\t\t\tRsGenericSerializer::SerializeContext& ctx(cReq);\n'
|
||||
inputParamsDeserialization += '\t\t{\n'
|
||||
inputParamsDeserialization += '\t\t\tRsGenericSerializer::SerializeContext& ctx(cReq);\n'
|
||||
inputParamsDeserialization += '\t\t\tRsGenericSerializer::SerializeJob j(RsGenericSerializer::FROM_JSON);\n';
|
||||
|
||||
outputParamsSerialization = ''
|
||||
@ -248,9 +248,9 @@ def processFile(file):
|
||||
outputParamsSerialization += '\t\t\tRS_SERIAL_PROCESS('
|
||||
outputParamsSerialization += mp._name + ');\n'
|
||||
|
||||
if hasInput:
|
||||
if hasInput:
|
||||
inputParamsDeserialization += '\t\t}\n'
|
||||
if retvalType != 'void':
|
||||
if retvalType != 'void':
|
||||
outputParamsSerialization += '\t\t\tRS_SERIAL_PROCESS(retval);\n'
|
||||
if hasOutput:
|
||||
outputParamsSerialization += '\t\t}\n'
|
||||
@ -270,7 +270,8 @@ def processFile(file):
|
||||
std::chrono::seconds(maxWait+120) );
|
||||
auto lService = weakService.lock();
|
||||
if(!lService || lService->is_down()) return;
|
||||
lService->schedule( [=]()
|
||||
auto io_context = lService->get_io_context();
|
||||
asio::post(*io_context, [=]()
|
||||
{
|
||||
auto session = weakSession.lock();
|
||||
if(session && session->is_open())
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
#include <restbed>
|
||||
#include <openssl/crypto.h>
|
||||
#include <asio.hpp>
|
||||
|
||||
|
||||
#include "jsonapi.h"
|
||||
@ -403,8 +404,8 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
|
||||
return;
|
||||
}
|
||||
|
||||
lService->schedule( [weakSession, hId, event]()
|
||||
{
|
||||
auto io_context = lService->get_io_context();
|
||||
asio::post(*io_context, [weakSession, hId, event]() {
|
||||
auto session = weakSession.lock();
|
||||
if(!session || session->is_closed())
|
||||
{
|
||||
|
||||
@ -96,7 +96,10 @@ public:
|
||||
{ "Content-Length", std::to_string(body.size()) }
|
||||
};
|
||||
|
||||
session->close(restbed::OK, body, headers);
|
||||
session->close(restbed::OK, restbed::Bytes(
|
||||
reinterpret_cast<const std::byte*>(body.data()),
|
||||
reinterpret_cast<const std::byte*>(body.data() + body.size())),
|
||||
headers);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user