Use synchronous locks for Peer state

We hold these locks for a short amount of time anyway, and using an
async lock could cause parallel sends to happen in an order different
than the order in which `send`/`request` was called.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-12 18:02:41 +01:00
parent 310def2923
commit 9e4b118214
4 changed files with 36 additions and 44 deletions

View file

@ -72,8 +72,8 @@ impl FakeServer {
server
}
pub async fn disconnect(&self) {
self.peer.disconnect(self.connection_id()).await;
pub fn disconnect(&self) {
self.peer.disconnect(self.connection_id());
self.connection_id.lock().take();
self.incoming.lock().take();
}