can't seem to fix Event ownership issue in run(){ ... loop {match event {} } }
This commit is contained in:
parent
e7b30d1753
commit
7a565c3696
|
@ -6,7 +6,9 @@ pub enum InternalEvent {
|
|||
Shutdown,
|
||||
}
|
||||
|
||||
|
||||
pub enum EventKind {
|
||||
//TODO maybe make message a trait
|
||||
Message,
|
||||
Internal(InternalEvent),
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ impl Endpoint for IrcEndpoint {
|
|||
sender_name: self.name(),
|
||||
}).await;
|
||||
|
||||
break;
|
||||
|
||||
return;
|
||||
|
||||
loop {
|
||||
//TODO impl
|
||||
|
|
15
src/state.rs
15
src/state.rs
|
@ -106,7 +106,7 @@ impl RircdState {
|
|||
let event = event.unwrap();
|
||||
|
||||
//EVENT MATCHING
|
||||
match event.kind {
|
||||
match &event.kind {
|
||||
|
||||
//INTERNAL
|
||||
EventKind::Internal(ev) => {
|
||||
|
@ -145,9 +145,18 @@ impl RircdState {
|
|||
assert!( event.result_sender.send(EventResponse::Success).is_ok());
|
||||
},
|
||||
|
||||
//EXTERNAL
|
||||
//MESSAGE
|
||||
EventKind::Message => {
|
||||
|
||||
//TODO maybe notify sender if one
|
||||
//of the endpoints isn't connected
|
||||
//or just write to log or do nothing depending
|
||||
//on the chosen configuration
|
||||
iter(&self.endpoints).all(|ep| async {
|
||||
if ep.endpoint.name() == event.sender_name {
|
||||
ep.sender.unwrap().send(event);
|
||||
}
|
||||
false
|
||||
}).await;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue