mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-05 20:50:34 +02:00
fix: removing redundancy
This commit is contained in:
@@ -85,11 +85,7 @@ func NewConnection(ctx context.Context, url string, requestHeader http.Header) (
|
||||
})
|
||||
}
|
||||
|
||||
writer := wsutil.NewWriter(
|
||||
conn,
|
||||
state,
|
||||
ws.OpText,
|
||||
)
|
||||
writer := wsutil.NewWriter(conn, state, ws.OpText)
|
||||
writer.SetExtensions(&msgState)
|
||||
|
||||
return &Connection{
|
||||
@@ -121,8 +117,7 @@ func (c *Connection) WriteMessage(data []byte) error {
|
||||
return fmt.Errorf("failed to write message: %w", err)
|
||||
}
|
||||
|
||||
err := c.flateWriter.Close()
|
||||
if err != nil {
|
||||
if err := c.flateWriter.Close(); err != nil {
|
||||
return fmt.Errorf("failed to close flate writer: %w", err)
|
||||
}
|
||||
} else {
|
||||
@@ -131,8 +126,7 @@ func (c *Connection) WriteMessage(data []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
err := c.writer.Flush()
|
||||
if err != nil {
|
||||
if err := c.writer.Flush(); err != nil {
|
||||
return fmt.Errorf("failed to flush writer: %w", err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user