Skip to content

Commit 2a81d48

Browse files
committed
http: remove unused node field from ws methods
1 parent 3bf55ed commit 2a81d48

File tree

1 file changed

+10
-33
lines changed

1 file changed

+10
-33
lines changed

src/http.rs

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn serve_index_html(
496496
directory: &str,
497497
authenticated: bool,
498498
local_only: bool,
499-
) -> anyhow::Result<(), anyhow::Error> {
499+
) -> anyhow::Result<()> {
500500
let _ = KiRequest::new()
501501
.target("our@vfs:sys:nectar".parse::<Address>()?)
502502
.body(serde_json::to_vec(&VfsRequest {
@@ -529,7 +529,7 @@ pub fn serve_ui(
529529
directory: &str,
530530
authenticated: bool,
531531
local_only: bool,
532-
) -> anyhow::Result<(), anyhow::Error> {
532+
) -> anyhow::Result<()> {
533533
serve_index_html(our, directory, authenticated, local_only)?;
534534

535535
let initial_path = format!("{}/pkg/{}", our.package_id(), directory);
@@ -614,7 +614,7 @@ pub fn handle_ui_asset_request(
614614
our: &Address,
615615
directory: &str,
616616
path: &str,
617-
) -> anyhow::Result<(), anyhow::Error> {
617+
) -> anyhow::Result<()> {
618618
let parts: Vec<&str> = path.split(&our.process.to_string()).collect();
619619
let after_process = parts.get(1).unwrap_or(&"");
620620

@@ -649,16 +649,12 @@ pub fn handle_ui_asset_request(
649649
}
650650

651651
pub fn send_ws_push(
652-
node: String,
653652
channel_id: u32,
654653
message_type: WsMessageType,
655654
blob: KiBlob,
656655
) -> anyhow::Result<()> {
657656
KiRequest::new()
658-
.target(Address::new(
659-
node,
660-
"http_server:distro:sys".parse::<ProcessId>().unwrap(),
661-
))
657+
.target("our@http_server:distro:sys".parse::<Address>()?)
662658
.body(
663659
serde_json::json!(HttpServerRequest::WebSocketPush {
664660
channel_id,
@@ -675,16 +671,12 @@ pub fn send_ws_push(
675671
}
676672

677673
pub fn open_ws_connection(
678-
node: String,
679674
url: String,
680675
headers: Option<HashMap<String, String>>,
681676
channel_id: u32,
682677
) -> anyhow::Result<()> {
683678
KiRequest::new()
684-
.target(Address::new(
685-
node,
686-
ProcessId::from_str("http_client:distro:sys").unwrap(),
687-
))
679+
.target("our@http_client:distro:sys".parse::<Address>()?)
688680
.body(
689681
serde_json::json!(HttpClientAction::WebSocketOpen {
690682
url,
@@ -701,16 +693,12 @@ pub fn open_ws_connection(
701693
}
702694

703695
pub fn open_ws_connection_and_await(
704-
node: String,
705696
url: String,
706697
headers: Option<HashMap<String, String>>,
707698
channel_id: u32,
708699
) -> std::result::Result<std::result::Result<Message, SendError>, anyhow::Error> {
709700
KiRequest::new()
710-
.target(Address::new(
711-
node,
712-
ProcessId::from_str("http_client:distro:sys").unwrap(),
713-
))
701+
.target("our@http_client:distro:sys".parse::<Address>()?)
714702
.body(
715703
serde_json::json!(HttpClientAction::WebSocketOpen {
716704
url,
@@ -725,16 +713,12 @@ pub fn open_ws_connection_and_await(
725713
}
726714

727715
pub fn send_ws_client_push(
728-
node: String,
729716
channel_id: u32,
730717
message_type: WsMessageType,
731718
blob: KiBlob,
732719
) -> std::result::Result<(), anyhow::Error> {
733720
KiRequest::new()
734-
.target(Address::new(
735-
node,
736-
ProcessId::from_str("http_client:distro:sys").unwrap(),
737-
))
721+
.target("our@http_client:distro:sys".parse::<Address>()?)
738722
.body(
739723
serde_json::json!(HttpClientAction::WebSocketPush {
740724
channel_id,
@@ -748,12 +732,9 @@ pub fn send_ws_client_push(
748732
.send()
749733
}
750734

751-
pub fn close_ws_connection(node: String, channel_id: u32) -> anyhow::Result<()> {
735+
pub fn close_ws_connection(channel_id: u32) -> anyhow::Result<()> {
752736
KiRequest::new()
753-
.target(Address::new(
754-
node,
755-
ProcessId::from_str("http_client:distro:sys").unwrap(),
756-
))
737+
.target("our@http_client:distro:sys".parse::<Address>()?)
757738
.body(
758739
serde_json::json!(HttpClientAction::WebSocketClose { channel_id })
759740
.to_string()
@@ -766,14 +747,10 @@ pub fn close_ws_connection(node: String, channel_id: u32) -> anyhow::Result<()>
766747
}
767748

768749
pub fn close_ws_connection_and_await(
769-
node: String,
770750
channel_id: u32,
771751
) -> std::result::Result<std::result::Result<Message, SendError>, anyhow::Error> {
772752
KiRequest::new()
773-
.target(Address::new(
774-
node,
775-
ProcessId::from_str("http_client:distro:sys").unwrap(),
776-
))
753+
.target("our@http_client:distro:sys".parse::<Address>()?)
777754
.body(
778755
serde_json::json!(HttpClientAction::WebSocketClose { channel_id })
779756
.to_string()

0 commit comments

Comments
 (0)