Skip to content

bug: async protocol.write(X).await on closed socket does not error #161

Description

@0xB10C

Originally posted by @0xB10C in #160 (comment)

Hm the test still passed when async writing to the closed protocol. I think that should return an error too? At least it doesn't hang..

index 5b96eca..e7cb5d1 100644
--- a/protocol/tests/round_trips.rs
+++ b/protocol/tests/round_trips.rs
@@ -229,6 +229,10 @@ async fn pingpong_with_closed_connection_async() {
         "Trying to read another message from the server, while the connection is already closed."
     );
     assert!(protocol.read().await.is_err());
+
+    let ping = V2NetworkMessage::new(NetworkMessage::Ping(45324));
+    let message = consensus::serialize(&ping);
+    protocol.write(&Payload::genuine(message)).await.unwrap();
 }

 #[test]

Probably a good followup once this is merged.

Tracking this here. I think writing to a closed connection should error too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions