Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 871e6b4

Browse files
stevejolix0r
authored andcommitted
Add a programatic way to exit linkerd-tcp (#24)
Problem: Some profiling tools are not well suited for long running server processes and rely on the process exiting to finish their work. Solution: POST /quitquitquit is an out-of-band signal for exiting the process. POST is used to prevent accidental curling (which uses GET by default) or web browsing from exiting the process.
1 parent ce21663 commit 871e6b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/admin_http.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use futures::{Future, future};
2-
use hyper::{self, Get, StatusCode};
2+
use hyper::{self, Get, Post, StatusCode};
33
use hyper::header::ContentLength;
44
use hyper::server::{Service, Request, Response};
55
use std::boxed::Box;
66
use std::cell::RefCell;
7+
use std::process;
78
use std::rc::Rc;
89

910
pub struct Server {
@@ -43,6 +44,9 @@ impl Service for Server {
4344
})
4445
.boxed()
4546
}
47+
(&Post, "/shutdown") => {
48+
process::exit(0);
49+
}
4650
_ => future::ok(Response::new().with_status(StatusCode::NotFound)).boxed(),
4751
}
4852
}

0 commit comments

Comments
 (0)