/// The task that will listen to results returned by the spawned tasks that process requests
/// as well as some other tasks that need to be confined to the lifetime of the Peer. These
/// include tasks spawned for timeouts, the task listening to incoming requests, ...
///
/// For request processing this either forwards responses to the peer for sending out, or errors
/// that need to be reported to the remote. In general it is considered that the errors returned directly
/// by the methods on ServiceMap contain relevant information for the Remote, but errors coming from
/// within the spawned tasks are just internal server errors. In any case RequestError will do
/// the right thing based on the error type, so this just forwards it to the handler for
/// RequestError.
///
/// It just returns a result so that it can be spawned on the same executor. It's infallible.
//
The task that will listen to results returned by the spawned tasks that process requests
as well as some other tasks that need to be confined to the lifetime of the Peer. These
include tasks spawned for timeouts, the task listening to incoming requests.

For request processing this either forwards responses to the peer for sending out, or errors
that need to be reported to the remote. In general it is considered that the errors returned directly
by the methods on ServiceMap contain relevant information for the Remote, but errors coming from
within the spawned tasks are just internal server errors. In any case RequestError will do
the right thing based on the error type, so this just forwards it to the handler for
RequestError.

It just returns a result so that it can be spawned on the same executor. It's infallible.
The task that will listen to results returned by the spawned tasks that process requests as well as some other tasks that need to be confined to the lifetime of the Peer . These include tasks spawned for timeouts the task listening to incoming requests . For request processing this either forwards responses to the peer for sending out or errors that need to be reported to the remote . In general it is considered that the errors returned directly by the methods on ServiceMap contain relevant information for the Remote but errors coming from within the spawned tasks are just internal server errors . In any case RequestError will do the right thing based on the error type so this just forwards it to the handler for RequestError . It just returns a result so that it can be spawned on the same executor . It ' s infallible .
async fn listen_request_results
	(
		mut stream: NurseryStream<Result<Response<Wf>, PeerErr>> ,
		mut addr  : Addr<Peer<Wf>>                               ,
	)
		-> Result<Response<Wf>, PeerErr>
	{
		while let Some(result) = stream.next().await
		{
			// The result of addr.send
			//
			let res = match result
			{
				Ok(resp) => match resp
				{
					Response::Nothing         => Ok(())               ,
					Response::WireFormat  (x) => addr.send( x ).await ,
					Response::CallResponse(x) => addr.send( x ).await ,
				}
				Err(err) => addr.send( RequestError::from( err ) ).await
			};
			// As we hold an address, the only way the mailbox can already be shut
			// is if the peer panics, or the mailbox get's dropped. Since the mailbox
			// owns the Peer, if it's dropped, this task doesn't exist anymore.
			// Should never happen.
			//
			debug_assert!( res.is_ok() );
		}
		Ok(Response::Nothing)
	}
async fn listen_request_results ( mut stream : NurseryStream < Result < Response < Wf > , PeerErr > > , mut addr : Addr < Peer < Wf > > , ) -> Result < Response < Wf > , PeerErr > { while let Some ( result ) = stream . next ( ) . await { // The result of addr.send // let res = match result { Ok ( resp ) => match resp { Response :: Nothing => Ok ( ( ) ) , Response :: WireFormat ( x ) => addr . send ( x ) . await , Response :: CallResponse ( x ) => addr . send ( x ) . await , } Err ( err ) => addr . send ( RequestError :: from ( err ) ) . await } ; // As we hold an address, the only way the mailbox can already be shut // is if the peer panics, or the mailbox get's dropped. Since the mailbox // owns the Peer, if it's dropped, this task doesn't exist anymore. // Should never happen. // debug_assert ! ( res is_ok ( ) ) ; } Ok ( Response :: Nothing ) }
The task that will listen to results returned by the spawned tasks that process requests
as well as some other tasks that need to be confined to the lifetime of the Peer.
The task that will listen to results returned by the spawned tasks that process requests as well as some other tasks that need to be confined to the lifetime of the Peer .
stream
NurseryStream<Result<Response<Wf>, PeerErr>>
addr
Addr<Peer<Wf>>