chiark
/
gitweb
/
~ian
/
hippotat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip server ipif
[hippotat.git]
/
server
/
server.rs
diff --git
a/server/server.rs
b/server/server.rs
index 5da413c501157e38a3158f46c359da087798fd95..b8cedaf9e8cf457597deb5ac2cfe934a22970a68 100644
(file)
--- a/
server/server.rs
+++ b/
server/server.rs
@@
-26,6
+26,7
@@
pub const INTERNAL_QUEUE: usize = 15; // xxx: config
#[derive(Debug)]
pub struct Global {
config: config::InstanceConfigGlobal,
#[derive(Debug)]
pub struct Global {
config: config::InstanceConfigGlobal,
+ local_rx: mpsc::Sender<RoutedPacket>,
all_clients: HashMap<ClientName, User>,
}
all_clients: HashMap<ClientName, User>,
}
@@
-72,7
+73,7
@@
async fn main() {
String,
)> = vec![];
String,
)> = vec![];
- let
(global, ipif)
= config::startup(
+ let
global
= config::startup(
"hippotatd", LinkEnd::Server,
&opts.config, &opts.log, |ics|
{
"hippotatd", LinkEnd::Server,
&opts.config, &opts.log, |ics|
{
@@
-105,8
+106,13
@@
async fn main() {
})
}).collect();
})
}).collect();
+ let (local_rx_send, local_tx_recv) = mpsc::channel(
+ 50 // xxx configurable?
+ );
+
let global = Arc::new(Global {
config: global_config,
let global = Arc::new(Global {
config: global_config,
+ local_rx: local_rx_send,
all_clients,
});
all_clients,
});
@@
-148,8
+154,15
@@
async fn main() {
});
tasks.push((task, format!("http server {}", addr)));
}
});
tasks.push((task, format!("http server {}", addr)));
}
-
- Ok((global, ipif))
+
+ let global_ = global.clone();
+ let ipif = tokio::task::spawn(async move {
+ slocal::run(global_, local_tx_recv, ipif).await
+ .void_unwrap_err()
+ });
+ tasks.push((ipif, format!("ipif")));
+
+ Ok(global)
});
let died = future::select_all(
});
let died = future::select_all(
@@
-157,7
+170,5
@@
async fn main() {
).await;
error!("xxx {:?}", &died);
).await;
error!("xxx {:?}", &died);
- ipif.quitting(None).await;
-
dbg!(global);
}
dbg!(global);
}