This commit is contained in:
Chris Beck
2025-12-05 09:37:40 -07:00
parent 8640fc7a15
commit 1a070011e3
+2 -11
View File
@@ -4,7 +4,7 @@
//! writing the message terminated with CRLF, and reading the response until CRLF. //! writing the message terminated with CRLF, and reading the response until CRLF.
use conf::Conf; use conf::Conf;
use signal_gateway::{AdminMessageResponse, MessageHandlerResult}; use signal_gateway::{AdminMessageResponse, MessageHandler, MessageHandlerResult};
use std::time::Duration; use std::time::Duration;
use tokio::{ use tokio::{
io::{AsyncBufReadExt, AsyncWriteExt, BufReader}, io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
@@ -28,16 +28,7 @@ impl AdminNetcatConfig {
/// ///
/// The returned handler opens a TCP connection to the configured address, /// The returned handler opens a TCP connection to the configured address,
/// writes the message terminated with CRLF, and reads the response until CRLF. /// writes the message terminated with CRLF, and reads the response until CRLF.
pub fn into_handler( pub fn into_handler(self) -> MessageHandler {
self,
) -> Box<
dyn Fn(
String,
)
-> std::pin::Pin<Box<dyn std::future::Future<Output = MessageHandlerResult> + Send>>
+ Send
+ Sync,
> {
Box::new(move |message: String| { Box::new(move |message: String| {
let config = self.clone(); let config = self.clone();
Box::pin(async move { handle_message(&config, message).await }) Box::pin(async move { handle_message(&config, message).await })