From dd89245c34da151ae17e45af4a785a4a8ea39632 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Fri, 25 Apr 2025 18:06:00 -0400 Subject: [PATCH] Change the result of Trans.SendWriter to a WriteCloser --- connection.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/connection.go b/connection.go index 05dec8a..7c82c8f 100644 --- a/connection.go +++ b/connection.go @@ -44,10 +44,12 @@ type Trans interface { // Send sends a message. This method is not safe for concurrent use. Send(method uint16, data []byte) error - // SendWriter sends data written to an [io.Writer]. Any writer - // previously opened through this function will be discarded. This - // method is not safe for concurrent use, and neither is its result. - SendWriter(method uint16) (io.Writer, error) + // SendWriter sends data written to an [io.Writer]. The writer must be + // closed after use. Closing the writer flushes any data that hasn't + // been written yet. Any writer previously opened through this function + // will be discarded. This method is not safe for concurrent use, and + // neither is its result. + SendWriter(method uint16) (io.WriteCloser, error) // Receive receives a message. This method is not safe for concurrent // use. Receive() (method uint16, data []byte, err error)