mirror of
https://github.com/RetroShare/libretroshare.git
synced 2026-09-14 11:05:45 +05:00
Merge 8744a671eb into 339c765235
This commit is contained in:
commit
6df781fa20
@ -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;
|
||||
|
||||
@ -176,7 +176,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())
|
||||
@ -225,8 +225,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 = ''
|
||||
@ -249,9 +249,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'
|
||||
@ -271,7 +271,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())
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
#include <restbed>
|
||||
#include <openssl/crypto.h>
|
||||
#include <asio.hpp>
|
||||
|
||||
|
||||
#include "jsonapi.h"
|
||||
@ -461,8 +462,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())
|
||||
{
|
||||
|
||||
@ -95,7 +95,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