Fix incorrect Ping Timeout
This commit is contained in:
@@ -187,6 +187,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto &session = it->second;
|
auto &session = it->second;
|
||||||
|
session->pingTimeout = std::chrono::steady_clock::now() + config::stream.ping_timeout;
|
||||||
|
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
@@ -396,8 +397,6 @@ void controlBroadcastThread(safe::event_t<bool> *shutdown_event, session_queue_t
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.map(packetTypes[IDX_INPUT_DATA], [&](session_t *session, const std::string_view &payload) {
|
server.map(packetTypes[IDX_INPUT_DATA], [&](session_t *session, const std::string_view &payload) {
|
||||||
session->pingTimeout = std::chrono::steady_clock::now() + config::stream.ping_timeout;
|
|
||||||
|
|
||||||
BOOST_LOG(debug) << "type [IDX_INPUT_DATA]"sv;
|
BOOST_LOG(debug) << "type [IDX_INPUT_DATA]"sv;
|
||||||
|
|
||||||
int32_t tagged_cipher_length = util::endian::big(*(int32_t*)payload.data());
|
int32_t tagged_cipher_length = util::endian::big(*(int32_t*)payload.data());
|
||||||
@@ -707,7 +706,7 @@ int recv_ping(decltype(broadcast)::ptr_t ref, socket_e type, asio::ip::address &
|
|||||||
messages->stop();
|
messages->stop();
|
||||||
|
|
||||||
if(!msg_opt) {
|
if(!msg_opt) {
|
||||||
BOOST_LOG(error) << "Ping Timeout"sv;
|
BOOST_LOG(error) << "Initial Ping Timeout"sv;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
#define KITTY_WHILE_LOOP(x, y, z) { x;while(y) z }
|
||||||
#define KITTY_DECL_CONSTR(x)\
|
#define KITTY_DECL_CONSTR(x)\
|
||||||
x(x&&) noexcept = default;\
|
x(x&&) noexcept = default;\
|
||||||
x&operator=(x&&) noexcept = default;\
|
x&operator=(x&&) noexcept = default;\
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ int capture_display(platf::img_t *img, std::unique_ptr<platf::display_t> &disp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
case platf::capture_e::error:
|
case platf::capture_e::error:
|
||||||
return -1;
|
return -1;
|
||||||
// Prevent warning during compilation
|
// Prevent warning during compilation
|
||||||
case platf::capture_e::timeout:
|
case platf::capture_e::timeout:
|
||||||
case platf::capture_e::ok:
|
case platf::capture_e::ok:
|
||||||
return 0;
|
return 1;
|
||||||
default:
|
default:
|
||||||
BOOST_LOG(error) << "Unrecognized capture status ["sv << (int)status << ']';
|
BOOST_LOG(error) << "Unrecognized capture status ["sv << (int)status << ']';
|
||||||
return -1;
|
return -1;
|
||||||
@@ -111,16 +111,17 @@ void captureThread(std::shared_ptr<safe::queue_t<capture_ctx_t>> capture_ctx_que
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<platf::img_t> img = disp->alloc_img();
|
std::shared_ptr<platf::img_t> img = disp->alloc_img();
|
||||||
auto has_error = capture_display(img.get(), disp);
|
auto result = capture_display(img.get(), disp);
|
||||||
if(has_error) {
|
if(result < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto time_point = std::chrono::steady_clock::now();
|
KITTY_WHILE_LOOP(auto time_point = std::chrono::steady_clock::now(); auto capture_ctx = std::begin(capture_ctxs), capture_ctx != std::end(capture_ctxs), {
|
||||||
for(auto capture_ctx = std::begin(capture_ctxs); capture_ctx != std::end(capture_ctxs); ++capture_ctx) {
|
|
||||||
if(!capture_ctx->images->running()) {
|
if(!capture_ctx->images->running()) {
|
||||||
capture_ctx = capture_ctxs.erase(capture_ctx);
|
capture_ctx = capture_ctxs.erase(capture_ctx);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,9 @@ void captureThread(std::shared_ptr<safe::queue_t<capture_ctx_t>> capture_ctx_que
|
|||||||
capture_ctx->images->raise(img);
|
capture_ctx->images->raise(img);
|
||||||
capture_ctx->next_frame = time_point + capture_ctx->delay;
|
capture_ctx->next_frame = time_point + capture_ctx->delay;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
++capture_ctx;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user