Skip to content

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

@0xB10C

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions