summaryrefslogtreecommitdiff
path: root/modules/websocket/emws_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket/emws_client.cpp')
-rw-r--r--modules/websocket/emws_client.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 5cd94e978f..e051a3b564 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,6 +31,7 @@
#ifdef JAVASCRIPT_ENABLED
#include "emws_client.h"
+
#include "core/config/project_settings.h"
#include "core/io/ip.h"
#include "emscripten.h"
@@ -45,8 +46,9 @@ void EMWSClient::_esws_on_message(void *obj, const uint8_t *p_data, int p_data_s
EMWSClient *client = static_cast<EMWSClient *>(obj);
Error err = static_cast<EMWSPeer *>(*client->get_peer(1))->read_msg(p_data, p_data_size, p_is_string == 1);
- if (err == OK)
+ if (err == OK) {
client->_on_peer_packet();
+ }
}
void EMWSClient::_esws_on_error(void *obj) {
@@ -71,8 +73,9 @@ Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
String proto_string;
for (int i = 0; i < p_protocols.size(); i++) {
- if (i != 0)
+ if (i != 0) {
proto_string += ",";
+ }
proto_string += p_protocols[i];
}
@@ -109,8 +112,9 @@ Ref<WebSocketPeer> EMWSClient::get_peer(int p_peer_id) const {
MultiplayerPeer::ConnectionStatus EMWSClient::get_connection_status() const {
if (_peer->is_connected_to_host()) {
- if (_is_connecting)
+ if (_is_connecting) {
return CONNECTION_CONNECTING;
+ }
return CONNECTION_CONNECTED;
}