summaryrefslogtreecommitdiff
path: root/modules/websocket
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket')
-rw-r--r--modules/websocket/emws_peer.cpp2
-rw-r--r--modules/websocket/emws_peer.h2
-rw-r--r--modules/websocket/emws_server.cpp4
-rw-r--r--modules/websocket/emws_server.h2
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp16
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h2
-rw-r--r--modules/websocket/wsl_peer.cpp10
-rw-r--r--modules/websocket/wsl_peer.h2
8 files changed, 20 insertions, 20 deletions
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index 588f38cffd..f396a1c812 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -90,7 +90,7 @@ Error EMWSPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
if (_in_buffer.packets_left() == 0)
return ERR_UNAVAILABLE;
- PoolVector<uint8_t>::Write rw = _packet_buffer.write();
+ uint8_t *rw = _packet_buffer.ptrw();
int read = 0;
Error err = _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read);
ERR_FAIL_COND_V(err != OK, err);
diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h
index 43b42f9be6..6308ebe490 100644
--- a/modules/websocket/emws_peer.h
+++ b/modules/websocket/emws_peer.h
@@ -48,7 +48,7 @@ private:
int peer_sock;
WriteMode write_mode;
- PoolVector<uint8_t> _packet_buffer;
+ Vector<uint8_t> _packet_buffer;
PacketBuffer<uint8_t> _in_buffer;
uint8_t _is_string;
diff --git a/modules/websocket/emws_server.cpp b/modules/websocket/emws_server.cpp
index 23faa05365..8ceefa42b6 100644
--- a/modules/websocket/emws_server.cpp
+++ b/modules/websocket/emws_server.cpp
@@ -53,8 +53,8 @@ Ref<WebSocketPeer> EMWSServer::get_peer(int p_id) const {
return NULL;
}
-PoolVector<String> EMWSServer::get_protocols() const {
- PoolVector<String> out;
+Vector<String> EMWSServer::get_protocols() const {
+ Vector<String> out;
return out;
}
diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h
index 869e59fe03..f273fd078f 100644
--- a/modules/websocket/emws_server.h
+++ b/modules/websocket/emws_server.h
@@ -53,7 +53,7 @@ public:
void disconnect_peer(int p_peer_id, int p_code = 1000, String p_reason = "");
int get_max_packet_size() const;
virtual void poll();
- virtual PoolVector<String> get_protocols() const;
+ virtual Vector<String> get_protocols() const;
EMWSServer();
~EMWSServer();
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index 27ea50b524..5c01d44ede 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -127,12 +127,12 @@ Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer
ERR_FAIL_COND_V_MSG(!_is_multiplayer, ERR_UNCONFIGURED, "Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI.");
- PoolVector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size);
+ Vector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size);
if (is_server()) {
- return _server_relay(1, _target_peer, &(buffer.read()[0]), buffer.size());
+ return _server_relay(1, _target_peer, &(buffer.ptr()[0]), buffer.size());
} else {
- return get_peer(1)->put_packet(&(buffer.read()[0]), buffer.size());
+ return get_peer(1)->put_packet(&(buffer.ptr()[0]), buffer.size());
}
}
@@ -183,16 +183,16 @@ void WebSocketMultiplayerPeer::_send_sys(Ref<WebSocketPeer> p_peer, uint8_t p_ty
ERR_FAIL_COND(!p_peer.is_valid());
ERR_FAIL_COND(!p_peer->is_connected_to_host());
- PoolVector<uint8_t> message = _make_pkt(p_type, 1, 0, (uint8_t *)&p_peer_id, 4);
- p_peer->put_packet(&(message.read()[0]), message.size());
+ Vector<uint8_t> message = _make_pkt(p_type, 1, 0, (uint8_t *)&p_peer_id, 4);
+ p_peer->put_packet(&(message.ptr()[0]), message.size());
}
-PoolVector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size) {
+Vector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size) {
- PoolVector<uint8_t> out;
+ Vector<uint8_t> out;
out.resize(PROTO_SIZE + p_data_size);
- PoolVector<uint8_t>::Write w = out.write();
+ uint8_t *w = out.ptrw();
copymem(&w[0], &p_type, 1);
copymem(&w[1], &p_from, 4);
copymem(&w[5], &p_to, 4);
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index 27cb6e4eb7..579972ada2 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -41,7 +41,7 @@ class WebSocketMultiplayerPeer : public NetworkedMultiplayerPeer {
GDCLASS(WebSocketMultiplayerPeer, NetworkedMultiplayerPeer);
private:
- PoolVector<uint8_t> _make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size);
+ Vector<uint8_t> _make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size);
void _store_pkt(int32_t p_source, int32_t p_dest, const uint8_t *p_data, uint32_t p_data_size);
Error _server_relay(int32_t p_from, int32_t p_to, const uint8_t *p_buffer, uint32_t p_buffer_size);
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index 08079145e4..ff32e83dc1 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -43,10 +43,10 @@ String WSLPeer::generate_key() {
// Random key
RandomNumberGenerator rng;
rng.set_seed(OS::get_singleton()->get_unix_time());
- PoolVector<uint8_t> bkey;
+ Vector<uint8_t> bkey;
int len = 16; // 16 bytes, as per RFC
bkey.resize(len);
- PoolVector<uint8_t>::Write w = bkey.write();
+ uint8_t *w = bkey.ptrw();
for (int i = 0; i < len; i++) {
w[i] = (uint8_t)rng.randi_range(0, 255);
}
@@ -260,10 +260,10 @@ Error WSLPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
return ERR_UNAVAILABLE;
int read = 0;
- PoolVector<uint8_t>::Write rw = _packet_buffer.write();
- _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read);
+ uint8_t *rw = _packet_buffer.ptrw();
+ _in_buffer.read_packet(rw, _packet_buffer.size(), &_is_string, read);
- *r_buffer = rw.ptr();
+ *r_buffer = rw;
r_buffer_size = read;
return OK;
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index f1c45ee859..00549cd9bc 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -86,7 +86,7 @@ private:
// Our packet info is just a boolean (is_string), using uint8_t for it.
PacketBuffer<uint8_t> _in_buffer;
- PoolVector<uint8_t> _packet_buffer;
+ Vector<uint8_t> _packet_buffer;
WriteMode write_mode;