diff options
Diffstat (limited to 'modules/websocket/wsl_server.cpp')
-rw-r--r-- | modules/websocket/wsl_server.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp index 7402bbb46e..514b2d055f 100644 --- a/modules/websocket/wsl_server.cpp +++ b/modules/websocket/wsl_server.cpp @@ -182,12 +182,12 @@ Error WSLServer::listen(int p_port, const Vector<String> p_protocols, bool gd_mp void WSLServer::poll() { List<int> remove_ids; - for (Map<int, Ref<WebSocketPeer>>::Element *E = _peer_map.front(); E; E = E->next()) { - Ref<WSLPeer> peer = (WSLPeer *)E->get().ptr(); + for (const KeyValue<int, Ref<WebSocketPeer>> &E : _peer_map) { + Ref<WSLPeer> peer = (WSLPeer *)E.value.ptr(); peer->poll(); if (!peer->is_connected_to_host()) { - _on_disconnect(E->key(), peer->close_code != -1); - remove_ids.push_back(E->key()); + _on_disconnect(E.key, peer->close_code != -1); + remove_ids.push_back(E.key); } } for (int &E : remove_ids) { @@ -265,8 +265,8 @@ int WSLServer::get_max_packet_size() const { void WSLServer::stop() { _server->stop(); - for (Map<int, Ref<WebSocketPeer>>::Element *E = _peer_map.front(); E; E = E->next()) { - Ref<WSLPeer> peer = (WSLPeer *)E->get().ptr(); + for (const KeyValue<int, Ref<WebSocketPeer>> &E : _peer_map) { + Ref<WSLPeer> peer = (WSLPeer *)E.value.ptr(); peer->close_now(); } _pending.clear(); |