🐛 Fix socket deadlock
This commit is contained in:
@@ -38,15 +38,15 @@ class CommAdapterBase {
|
|||||||
array.add(event);
|
array.add(event);
|
||||||
array.add(payload);
|
array.add(payload);
|
||||||
|
|
||||||
// TODO: Only send to subscribed
|
|
||||||
|
|
||||||
#if USE_MSGPACK
|
#if USE_MSGPACK
|
||||||
std::string bin;
|
std::string bin;
|
||||||
serializeMsgPack(doc, bin);
|
serializeMsgPack(doc, bin);
|
||||||
send(reinterpret_cast<const uint8_t *>(bin.data()), bin.size(), -1); // TODO: Make CID dynamic
|
xSemaphoreGive(mutex_);
|
||||||
|
send(reinterpret_cast<const uint8_t *>(bin.data()), bin.size(), -1);
|
||||||
#else
|
#else
|
||||||
String out;
|
String out;
|
||||||
serializeJson(doc, out);
|
serializeJson(doc, out);
|
||||||
|
xSemaphoreGive(mutex_);
|
||||||
send(out.c_str(), -1);
|
send(out.c_str(), -1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <communication/comm_base.hpp>
|
#include <communication/comm_base.hpp>
|
||||||
|
|
||||||
class Websocket : CommAdapterBase {
|
class Websocket : public CommAdapterBase {
|
||||||
public:
|
public:
|
||||||
Websocket(PsychicHttpServer &server, const char *route = "/api/ws");
|
Websocket(PsychicHttpServer &server, const char *route = "/api/ws");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user