Struct Connection
pub struct Connection {
socket: AsyncFd<Socket>,
requests: UnboundedReceiver<Outgoing>,
session: Session,
}Expand description
Sends the requests of a Client and receives the
responses and indications.
Returned by ClientBuilder::connect.
Requests only complete while Connection::run runs, for example in a
spawned task. Dropping the connection fails all requests.
Fields§
§socket: AsyncFd<Socket>§requests: UnboundedReceiver<Outgoing>§session: SessionImplementations§
§impl Connection
impl Connection
pub(super) const fn new( socket: AsyncFd<Socket>, requests: UnboundedReceiver<Outgoing>, session: Session, ) -> Self
pub async fn run(self) -> Result<(), Disconnect>
pub async fn run(self) -> Result<(), Disconnect>
Runs the connection until every client is dropped or the connection fails.
Returns Ok once every client is dropped.
Until irsc_util has loaded the security rules of the router, sending
a request blocks the thread. Not even SIGKILL interrupts the wait, and
it never ends if irsc_util doesn’t run. Start services that use this
crate after the init_irsc_util init script (S29 on EVA, S30 on EVD).
§Errors
Returns why the connection failed, for example because the server was removed. The client then fails all requests. The new server has none of the state of the old one, so connect again and repeat the setup, like registering for indications.