fix some things

This commit is contained in:
Joseph Montanaro
2022-11-29 16:13:09 -08:00
parent 397928b8f1
commit 234d9e0471
3 changed files with 22 additions and 6 deletions

View File

@ -7,7 +7,7 @@ use tokio::sync::oneshot;
use tauri::{AppHandle, Manager};
use crate::errors::RequestError;
use crate::ipc::Approval;
use crate::ipc::{Request, Approval};
pub async fn serve(addr: SocketAddrV4, app_handle: AppHandle) -> io::Result<()> {
@ -45,6 +45,8 @@ async fn handle(mut stream: TcpStream, app_handle: AppHandle) -> Result<(), Requ
let (chan_send, chan_recv) = oneshot::channel();
let app_state = app_handle.state::<crate::state::AppState>();
let request_id = app_state.register_request(chan_send);
// Do we want to panic if this fails? Does that mean the frontend is dead?
app_handle.emit_all("credentials-request", Request {id: request_id}).unwrap();
let mut buf = [0; 8192]; // it's what tokio's BufReader uses
let mut n = 0;