pub async fn shutdown( shared_state: Arc<Mutex<PeerSharedState>>) -> Result<(), Box<dyn Error + Send + Sync>>