()
| 219 | } |
| 220 | |
| 221 | fn main() { |
| 222 | env_logger::init(); |
| 223 | |
| 224 | let config = Configuration::from_args(std::env::args()); |
| 225 | let timely_config: timely::Configuration = config.clone().into(); |
| 226 | let server_config: server::Configuration = config.clone().into(); |
| 227 | |
| 228 | timely::execute(timely_config, move |worker| { |
| 229 | // Initialize server state (no networking). |
| 230 | let mut server = Server::<T, Token>::new_at(server_config.clone(), worker.timer()); |
| 231 | |
| 232 | if server_config.enable_logging { |
| 233 | #[cfg(feature = "real-time")] |
| 234 | server.enable_logging(worker).unwrap(); |
| 235 | } |
| 236 | |
| 237 | // The server might specify a sequence of requests for |
| 238 | // setting-up built-in arrangements. We serialize those here |
| 239 | // and pre-load the sequencer with them, such that they will |
| 240 | // flow through the regular request handling. |
| 241 | let builtins = Server::<T, Token>::builtins(); |
| 242 | let preload_command = Command { |
| 243 | owner: worker.index(), |
| 244 | client: SYSTEM.0, |
| 245 | requests: builtins, |
| 246 | }; |
| 247 | |
| 248 | // Setup serializing command stream between all workers. |
| 249 | let mut sequencer: Sequencer<Command> = |
| 250 | Sequencer::preloaded(worker, Instant::now(), VecDeque::from(vec![preload_command])); |
| 251 | |
| 252 | // Kickoff ticking, if configured. We only want to issue ticks |
| 253 | // from a single worker, to avoid redundant ticking. |
| 254 | if worker.index() == 0 && server_config.tick.is_some() { |
| 255 | sequencer.push(Command { |
| 256 | owner: 0, |
| 257 | client: SYSTEM.0, |
| 258 | requests: vec![Request::Tick], |
| 259 | }); |
| 260 | } |
| 261 | |
| 262 | // Set up I/O event loop. |
| 263 | let mut io = { |
| 264 | use std::net::{IpAddr, Ipv4Addr, SocketAddr}; |
| 265 | |
| 266 | // let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), config.port); |
| 267 | let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0,0,0,0)), config.port); |
| 268 | |
| 269 | IO::new(addr) |
| 270 | }; |
| 271 | |
| 272 | info!( |
| 273 | "[W{}] running with config {:?}, {} peers", |
| 274 | worker.index(), |
| 275 | config, |
| 276 | worker.peers(), |
| 277 | ); |
| 278 |
nothing calls this directly
no test coverage detected