Merge pull request #877 from jongiddy/guide-save-receiver

Fix guide example to save receiver for later use by response handler.
This commit is contained in:
Sean McArthur
2016-07-31 23:54:12 -07:00
committed by GitHub

View File

@@ -314,7 +314,9 @@ impl Handler<Http> for Text {
"/question" => {
let (tx, rx) = mpsc::channel();
// queue work on our worker
self.worker_tx.send((self.control.take().unwrap(), tx));
self.worker_tx.send((self.control.take().unwrap(), tx)).unwrap();
// save receive channel for response handling
self.worker_rx = Some(rx);
// tell hyper we need to wait until we can continue
return Next::wait();
}