1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

relay: add villas-relay to build system

This commit is contained in:
Steffen Vogel 2018-07-16 22:19:55 +02:00
parent 750f0374bc
commit 704c4cd59f
2 changed files with 9 additions and 7 deletions

View file

@ -23,6 +23,7 @@
# All executables link against libvillas
link_libraries(villas)
add_executable(villas-relay villas-relay.cpp)
add_executable(villas-node villas-node.cpp)
add_executable(villas-test-rtt villas-test-rtt.cpp)
add_executable(villas-test-shmem villas-test-shmem.cpp)

View file

@ -42,8 +42,8 @@ static lws_vhost *vhost;
/* Forward declarations */
lws_callback_function protocol_cb;
struct Session;
struct Connection;
class Session;
class Connection;
static std::map<std::string, std::shared_ptr<Session>> sessions;
@ -101,7 +101,7 @@ public:
}
else {
info("Reusing existing session: %s", sid.c_str());
return it->second;
}
}
@ -125,7 +125,7 @@ protected:
std::shared_ptr<Frame> currentFrame;
std::queue<std::shared_ptr<Frame>> outgoingFrames;
std::queue<std::shared_ptr<Frame>> outgoingFrames;
std::shared_ptr<Session> session;
@ -135,7 +135,7 @@ public:
currentFrame(std::make_shared<Frame>()),
outgoingFrames()
{
session = Session::get(sid);
session = Session::get(wsi);
session->connections[wsi] = std::shared_ptr<Connection>(this);
info("New connection established to session: %s", session->identifier.c_str());
@ -162,7 +162,7 @@ public:
if (lws_is_final_fragment(wsi)) {
debug(5, "Received frame, relaying to %zu connections", session->connections.size() - (opts.loopback ? 0 : 1));
for (auto p : session->connections) {
auto c = p.second;
@ -232,7 +232,7 @@ int protocol_cb(lws *wsi, enum lws_callback_reasons reason, void *user, void *in
switch (reason) {
case LWS_CALLBACK_ESTABLISHED:
case LWS_CALLBACK_ESTABLISHED: {
auto s = Session::get(wsi);
try {
@ -243,6 +243,7 @@ int protocol_cb(lws *wsi, enum lws_callback_reasons reason, void *user, void *in
return -1;
}
break;
}
case LWS_CALLBACK_CLOSED:
c->~Connection();