Skip to content

Commit 4783f5d

Browse files
committed
Rename arguments to bind/listen to agent
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
1 parent 2b8aa88 commit 4783f5d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/agent.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,15 @@ where
359359
/// .await?;
360360
/// # Ok(()) }
361361
/// ```
362-
pub async fn listen<S>(mut socket: S, mut sf: impl Agent<S>) -> Result<(), AgentError>
362+
pub async fn listen<S>(mut socket: S, mut agent: impl Agent<S>) -> Result<(), AgentError>
363363
where
364364
S: ListeningSocket + fmt::Debug + Send,
365365
{
366366
log::info!("Listening; socket = {:?}", socket);
367367
loop {
368368
match socket.accept().await {
369369
Ok(socket) => {
370-
let session = sf.new_session(&socket);
370+
let session = agent.new_session(&socket);
371371
tokio::spawn(async move {
372372
let adapter = Framed::new(socket, Codec::<Request, Response>::default());
373373
if let Err(e) = handle_socket::<S>(session, adapter).await {
@@ -417,17 +417,17 @@ where
417417

418418
/// Bind to a service binding listener.
419419
#[cfg(unix)]
420-
pub async fn bind<SF>(listener: service_binding::Listener, sf: SF) -> Result<(), AgentError>
420+
pub async fn bind<A>(listener: service_binding::Listener, agent: A) -> Result<(), AgentError>
421421
where
422-
SF: Agent<tokio::net::UnixListener> + Agent<tokio::net::TcpListener>,
422+
A: Agent<tokio::net::UnixListener> + Agent<tokio::net::TcpListener>,
423423
{
424424
match listener {
425425
#[cfg(unix)]
426426
service_binding::Listener::Unix(listener) => {
427-
listen(UnixListener::from_std(listener)?, sf).await
427+
listen(UnixListener::from_std(listener)?, agent).await
428428
}
429429
service_binding::Listener::Tcp(listener) => {
430-
listen(TcpListener::from_std(listener)?, sf).await
430+
listen(TcpListener::from_std(listener)?, agent).await
431431
}
432432
_ => Err(AgentError::IO(std::io::Error::other(
433433
"Unsupported type of a listener.",
@@ -437,16 +437,16 @@ where
437437

438438
/// Bind to a service binding listener.
439439
#[cfg(windows)]
440-
pub async fn bind<SF>(listener: service_binding::Listener, sf: SF) -> Result<(), AgentError>
440+
pub async fn bind<A>(listener: service_binding::Listener, agent: A) -> Result<(), AgentError>
441441
where
442-
SF: Agent<NamedPipeListener> + Agent<tokio::net::TcpListener>,
442+
A: Agent<NamedPipeListener> + Agent<tokio::net::TcpListener>,
443443
{
444444
match listener {
445445
service_binding::Listener::Tcp(listener) => {
446-
listen(TcpListener::from_std(listener)?, sf).await
446+
listen(TcpListener::from_std(listener)?, agent).await
447447
}
448448
service_binding::Listener::NamedPipe(pipe) => {
449-
listen(NamedPipeListener::bind(pipe)?, sf).await
449+
listen(NamedPipeListener::bind(pipe)?, agent).await
450450
}
451451
}
452452
}

0 commit comments

Comments
 (0)