1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

x.websocket: workaround for _, item in a_map{} bug, causing panic (#8463)

This commit is contained in:
Tomas Hellström 2021-01-31 10:37:32 +01:00 committed by GitHub
parent 5746ac4dd4
commit 7eb7d042ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,8 +26,9 @@ fn start_server() ? {
// on_message_ref, broadcast all incoming messages to all clients except the one sent it
s.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, mut m websocket.Server) ? {
for _, cli in m.clients {
mut c := cli
// for _, cli in m.clients {
for i, _ in m.clients {
mut c := m.clients[i]
if c.client.state == .open && c.client.id != ws.id {
c.client.write(msg.payload, websocket.OPCode.text_frame) or {
panic(err)