There was an error while loading. Please reload this page.
1 parent 11df0b8 commit f0c8bb8Copy full SHA for f0c8bb8
1 file changed
server/network/src/worker.rs
@@ -98,13 +98,19 @@ pub async fn run_worker(
98
Err(e) => format!("{}", e),
99
};
100
101
- let _ = worker
102
- .listener_tx
103
- .send(ListenerToServerMessage::DeleteEntity(worker.entity));
104
-
105
let _ = worker
106
.tx
107
.send(WorkerToServerMessage::NotifyDisconnected { reason: msg });
+
+ // If server is not aware of connection (and thus
+ // will not receive the above message), instruct it
+ // to delete the entity. Otherwise, it will delete it
108
+ // through the message above.
109
+ if worker.server_rx.is_some() {
110
+ let _ = worker
111
+ .listener_tx
112
+ .send(ListenerToServerMessage::DeleteEntity(worker.entity));
113
+ }
114
}
115
116
async fn request_entity(
0 commit comments