м
можно конеш сделать через tokio::mpsc, но не хотелось бы экспозить этот API)
Size: a a a
м
ph
м
Ct
select https://docs.rs/futures/0.2.1/futures/stream/trait.StreamExt.html#method.selectм
future::select, но пропустил существование stream::select()м
м
ph
ph
м
м
ph
let http = listener.incoming().map(|(s, sa)| Connection::Http(s, sa));
let http2 = listener2.incoming().map(|(s, sa)| Connection::Http2(s, sa));
info!("Ready to go");
let server = http.select(http2).for_each(|conn| {
match conn {
Connection::Http(sock, addr) => {
let s = s.clone();
Http::new().bind_connection(&handle2, sock, addr, s);
},
Connection::Http2(sock, _addr) => {
let http2_sc = httpbis::server_conf::ServerConf::new();
let (_conn, future) = httpbis::server_conn::ServerConnection::new_plain_single_thread(&handle3, sock, http2_sc, grpc.clone());
handle3.spawn(future.map_err(|e| error!("Error servicing http2 {}", e)));
},
}
Ok(())
});
core.run(server).unwrap();м
м
conn1.select(conn2).select(conn3) лолph
ph
м
stream::select_all(): https://docs.rs/futures/0.2.1/futures/stream/fn.select_all.htmlph
ph
ph