Skip to content

Commit 610b0f6

Browse files
committed
Replace civet with conduit-hyper
1 parent 50cc1d4 commit 610b0f6

File tree

4 files changed

+25
-32
lines changed

4 files changed

+25
-32
lines changed

Cargo.lock

Lines changed: 16 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ conduit-middleware = "0.8"
6767
conduit-router = "0.8"
6868
conduit-static = "0.8"
6969
conduit-git-http-backend = "0.8"
70-
civet = "0.9"
70+
conduit-hyper = "0.1"
7171

7272
[dev-dependencies]
7373
conduit-test = "0.8"

docs/BACKEND.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ The server does the following things:
1212
3. Reads values from environment variables to configure a new instance of `cargo_registry::App`
1313
4. Adds middleware to the app by calling `cargo_registry::middleware`
1414
5. Syncs the categories defined in *src/categories.toml* with the categories in the database
15-
6. Starts a [civet][] `Server` that uses the `cargo_registry::App` instance
15+
6. Starts a [hyper] server that uses the `cargo_registry::App` instance
1616
7. Tells Nginx on Heroku that the application is ready to receive requests, if running on Heroku
17-
8. Blocks forever (or until the process is killed) waiting to receive messages on a channel that no
18-
messages are ever sent to, in order to outive the civet `Server` threads
17+
8. Blocks forever (or until the process is killed)
1918

20-
[civet]: https://crates.io/crates/civet
19+
[hyper]: https://crates.io/crates/hyper
2120

2221
## Routes
2322

src/bin/server.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#![deny(warnings)]
22

33
extern crate cargo_registry;
4-
extern crate civet;
4+
extern crate conduit_hyper;
55
extern crate env_logger;
66
extern crate git2;
77

88
use cargo_registry::{env, Env};
9-
use civet::Server;
9+
use conduit_hyper::Service;
1010
use std::env;
1111
use std::fs::{self, File};
12-
use std::sync::mpsc::channel;
1312
use std::sync::Arc;
1413

1514
fn main() {
@@ -66,9 +65,8 @@ fn main() {
6665
} else {
6766
50
6867
};
69-
let mut cfg = civet::Config::new();
70-
cfg.port(port).threads(threads).keep_alive(true);
71-
let _a = Server::start(cfg, app);
68+
let addr = ([127, 0, 0, 1], port).into();
69+
let server = Service::new(app, threads);
7270

7371
println!("listening on port {}", port);
7472

@@ -79,6 +77,5 @@ fn main() {
7977
}
8078

8179
// TODO: handle a graceful shutdown by just waiting for a SIG{INT,TERM}
82-
let (_tx, rx) = channel::<()>();
83-
rx.recv().unwrap();
80+
server.run(addr);
8481
}

0 commit comments

Comments
 (0)