summaryrefslogtreecommitdiff
path: root/modules/websocket/wsl_peer.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket/wsl_peer.h')
-rw-r--r--modules/websocket/wsl_peer.h46
1 files changed, 17 insertions, 29 deletions
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index fe4abfb64c..5e6a7e8554 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 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 */
@@ -33,10 +33,10 @@
#ifndef JAVASCRIPT_ENABLED
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/ring_buffer.h"
+#include "core/templates/ring_buffer.h"
#include "packet_buffer.h"
#include "websocket_peer.h"
#include "wslay/wslay.h"
@@ -48,29 +48,17 @@ class WSLPeer : public WebSocketPeer {
public:
struct PeerData {
- bool polling;
- bool destroy;
- bool valid;
- bool is_server;
- bool closing;
- void *obj;
- void *peer;
+ bool polling = false;
+ bool destroy = false;
+ bool valid = false;
+ bool is_server = false;
+ bool closing = false;
+ void *obj = nullptr;
+ void *peer = nullptr;
Ref<StreamPeer> conn;
Ref<StreamPeerTCP> tcp;
- int id;
- wslay_event_context_ptr ctx;
-
- PeerData() {
- polling = false;
- destroy = false;
- valid = false;
- is_server = false;
- id = 1;
- ctx = nullptr;
- obj = nullptr;
- closing = false;
- peer = nullptr;
- }
+ int id = 1;
+ wslay_event_context_ptr ctx = nullptr;
};
static String compute_key_response(String p_key);
@@ -80,17 +68,17 @@ private:
static bool _wsl_poll(struct PeerData *p_data);
static void _wsl_destroy(struct PeerData **p_data);
- struct PeerData *_data;
- uint8_t _is_string;
+ struct PeerData *_data = nullptr;
+ uint8_t _is_string = 0;
// Our packet info is just a boolean (is_string), using uint8_t for it.
PacketBuffer<uint8_t> _in_buffer;
Vector<uint8_t> _packet_buffer;
- WriteMode write_mode;
+ WriteMode write_mode = WRITE_MODE_BINARY;
public:
- int close_code;
+ int close_code = -1;
String close_reason;
void poll(); // Used by client and server.