Some more updates

This commit is contained in:
WolverinDEV
2020-09-06 21:00:27 +02:00
parent 7d0db0dea0
commit 4f5a4dc993
16 changed files with 453 additions and 202 deletions
+7 -6
View File
@@ -12,7 +12,7 @@ using namespace ts::protocol;
void WebClient::handleMessageWrite(int fd, short, void *) {
auto self_lock = _this.lock();
unique_lock buffer_lock(this->queue_lock);
unique_lock buffer_lock(this->queue_mutex);
if(this->queue_write.empty()) return;
auto buffer = this->queue_write[0];
@@ -85,7 +85,7 @@ void WebClient::handleMessageRead(int fd, short, void *) {
pbuffer.write(buffer, length);
{
lock_guard lock(this->queue_lock);
lock_guard lock(this->queue_mutex);
this->queue_read.push_back(std::move(pbuffer));
}
@@ -95,7 +95,7 @@ void WebClient::handleMessageRead(int fd, short, void *) {
void WebClient::enqueue_raw_packet(const pipes::buffer_view &msg) {
auto buffer = msg.owns_buffer() ? msg.own_buffer() : msg.own_buffer(); /* TODO: Use buffer::allocate_buffer(...) */
{
lock_guard queue_lock(this->queue_lock);
lock_guard queue_lock(this->queue_mutex);
this->queue_write.push_back(buffer);
}
{
@@ -124,11 +124,11 @@ inline bool is_ssl_handshake_header(const pipes::buffer_view& buffer) {
}
void WebClient::processNextMessage(const std::chrono::system_clock::time_point& /* scheduled */) {
lock_guard execute_lock(this->execute_lock);
lock_guard execute_lock(this->execute_mutex);
if(this->state != ConnectionState::INIT_HIGH && this->state != ConnectionState::INIT_LOW && this->state != ConnectionState::CONNECTED)
return;
unique_lock buffer_lock(this->queue_lock);
unique_lock buffer_lock(this->queue_mutex);
if(this->queue_read.empty())
return;
@@ -152,6 +152,7 @@ void WebClient::processNextMessage(const std::chrono::system_clock::time_point&
this->ws_handler.process_incoming_data(buffer);
}
if(has_next)
if(has_next) {
this->registerMessageProcess();
}
}