formatting pass
This commit is contained in:
1 parent
d976eebbbc
commit
e4cfa53bce
21 files changed
+333
-194
No files matched your search
+14
-11
@@ -1,22 +1,21 @@
|
||||
use crate::error::CreddyError;
|
||||
use gpui_kit::AsyncApp;
|
||||
use http_body_util::Full;
|
||||
use hyper::{Request, Response, StatusCode};
|
||||
use hyper::body::{Incoming, Bytes};
|
||||
use hyper::service::service_fn;
|
||||
use hyper::body::{Bytes, Incoming};
|
||||
use hyper::server::conn::http1;
|
||||
use hyper::service::service_fn;
|
||||
use hyper::{Request, Response, StatusCode};
|
||||
use rustix::net::sockopt::socket_peercred;
|
||||
use rustix::process::Pid;
|
||||
use smol::Timer;
|
||||
use smol::net::unix::{UnixListener, UnixStream};
|
||||
use smol_hyper::rt::FuturesIo;
|
||||
use rustix::net::sockopt::socket_peercred;
|
||||
use rustix::process::Pid;
|
||||
use std::convert::Infallible;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
pub fn start_creddy_server(path: &Path, app: AsyncApp) -> Result<(), CreddyError> {
|
||||
if path.exists() {
|
||||
fs::remove_file(path)?;
|
||||
@@ -42,14 +41,15 @@ pub fn start_creddy_server(path: &Path, app: AsyncApp) -> Result<(), CreddyError
|
||||
if let Err(e) = conn.await {
|
||||
eprintln!("Error serving connection: {e}")
|
||||
}
|
||||
}).detach();
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
}).detach();
|
||||
})
|
||||
.detach();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
async fn accept(listener: &UnixListener) -> io::Result<(UnixStream, Pid)> {
|
||||
let (stream, _) = listener.accept().await?;
|
||||
// pid() never returns None on Linux
|
||||
@@ -57,8 +57,11 @@ async fn accept(listener: &UnixListener) -> io::Result<(UnixStream, Pid)> {
|
||||
Ok((stream, pid))
|
||||
}
|
||||
|
||||
|
||||
async fn handle(req: Request<Incoming>, pid: Pid, app: AsyncApp) -> Result<Response<Full<Bytes>>, Infallible> {
|
||||
async fn handle(
|
||||
req: Request<Incoming>,
|
||||
pid: Pid,
|
||||
app: AsyncApp,
|
||||
) -> Result<Response<Full<Bytes>>, Infallible> {
|
||||
Ok(Response::new(Full::new(Bytes::from("hello world"))))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user