diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-10 14:04:44 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-10 14:04:44 +0000 |
| commit | f34d0952eea4f4fac97be0cf46d0c105e1690866 (patch) | |
| tree | f536fa486a77bfc6daf8f1b1ceb8ad85589d3c8d | |
| parent | d450e2bd2bab8a5e13084edcc0eec45194ac9fb6 (diff) | |
refactor: remove insert-remove pattern in spawn_relay_connection (SIMPLIFY-3)
| -rw-r--r-- | src/sync/mod.rs | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 0e39aaf..d53bcfa 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs | |||
| @@ -1300,9 +1300,6 @@ impl SyncManager { | |||
| 1300 | state.disconnected_at = None; | 1300 | state.disconnected_at = None; |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
| 1303 | // Store connection for later use (for subscribing to filters) | ||
| 1304 | self.connections.insert(relay_url.clone(), connection); | ||
| 1305 | |||
| 1306 | // Notify SyncManager of successful connection | 1303 | // Notify SyncManager of successful connection |
| 1307 | let _ = connect_tx | 1304 | let _ = connect_tx |
| 1308 | .send(ConnectNotification { | 1305 | .send(ConnectNotification { |
| @@ -1310,16 +1307,6 @@ impl SyncManager { | |||
| 1310 | }) | 1307 | }) |
| 1311 | .await; | 1308 | .await; |
| 1312 | 1309 | ||
| 1313 | // Get the connection back for the event loop | ||
| 1314 | // We need to take it out because run_event_loop consumes self | ||
| 1315 | let connection = match self.connections.remove(&relay_url) { | ||
| 1316 | Some(conn) => conn, | ||
| 1317 | None => { | ||
| 1318 | tracing::error!(relay = %relay_url, "Connection disappeared after insert"); | ||
| 1319 | return; | ||
| 1320 | } | ||
| 1321 | }; | ||
| 1322 | |||
| 1323 | // Create event channel | 1310 | // Create event channel |
| 1324 | let (event_tx, mut event_rx) = mpsc::channel::<RelayEvent>(1000); | 1311 | let (event_tx, mut event_rx) = mpsc::channel::<RelayEvent>(1000); |
| 1325 | 1312 | ||