diff --git a/src/main.rs b/src/main.rs index 27468d4..722dfa8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,6 +157,14 @@ struct Match { struct TMClient { notices: mpsc::Sender, + requests: mpsc::Receiver, + responses: mpsc::Sender, +} + +struct TMConnection { + notices: mpsc::Receiver, + requests: mpsc::Sender, + responses: mpsc::Receiver, } struct BackendMessage { @@ -164,11 +172,20 @@ struct BackendMessage { } impl TMClient { - fn new() -> (TMClient, mpsc::Receiver) { - let (tx, rx) = mpsc::channel(); - (TMClient { - notices: tx, - }, rx) + fn new() -> (TMClient, TMConnection) { + let (notice_tx, notice_rx) = mpsc::channel(); + let (request_tx, request_rx) = mpsc::channel(); + let (response_tx, response_rx) = mpsc::channel(); + (TMClient{ + notices: notice_tx, + requests: request_rx, + responses: response_tx + }, + TMConnection{ + notices: notice_rx, + requests: request_tx, + responses: response_rx + },) } fn process(self: &TMClient) { @@ -321,7 +338,7 @@ fn main() { ); let running = true; - let (tm_client, tm_notices) = TMClient::new(); + let (tm_client, tm_connection) = TMClient::new(); let tm_thread = thread::spawn(move || while running { tm_client.process(); @@ -329,7 +346,7 @@ fn main() { ); while running { - match tm_notices.recv() { + match tm_connection.notices.recv() { Ok(notice) => { let callback = callbacks.get(¬ice.id()); match callback {