From be9d43f8cc8b10dbabf488cef60d655d6b305207 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 17 Feb 2023 17:03:14 +0100 Subject: [PATCH] Don't reconnect when encountering 404 --- CHANGELOG.md | 1 + src/bot/instance.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a99d23..df9c471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Procedure when bumping the version number: ### Fixed - `!uptime` minute count +- Instance reconnecting after encountering a 404 (it now stops and logs an error) ## v0.3.0 - 2023-02-11 diff --git a/src/bot/instance.rs b/src/bot/instance.rs index c651bb9..668cc2c 100644 --- a/src/bot/instance.rs +++ b/src/bot/instance.rs @@ -11,7 +11,7 @@ use cookie::{Cookie, CookieJar}; use tokio::select; use tokio::sync::{mpsc, oneshot}; use tokio_tungstenite::tungstenite; -use tokio_tungstenite::tungstenite::http::HeaderValue; +use tokio_tungstenite::tungstenite::http::{HeaderValue, StatusCode}; use crate::api::packet::ParsedPacket; use crate::api::{Auth, AuthOption, Data, Nick}; @@ -364,6 +364,12 @@ impl Instance { idebug!(config, "Instance dropped"); break; } + Err(RunError::CouldNotConnect(tungstenite::Error::Http(response))) + if response.status() == StatusCode::NOT_FOUND => + { + iwarn!(config, "Failed to connect: room does not exist"); + break; + } Err(RunError::CouldNotConnect(err)) => { iwarn!(config, "Failed to connect: {err}"); false