Skip to content

Commit

Permalink
memory optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
uoosef committed Nov 23, 2023
1 parent ba04ea0 commit c45aede
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,9 @@ type readOnlyConn struct {
reader io.Reader
}

func (conn readOnlyConn) Read(p []byte) (int, error) { return conn.reader.Read(p) }
func (conn readOnlyConn) Write(p []byte) (int, error) { return 0, io.ErrClosedPipe }
func (conn readOnlyConn) Close() error {
if tcpConn, ok := conn.reader.(io.Closer); ok {
return tcpConn.Close()
}
return nil
}
func (conn readOnlyConn) Read(p []byte) (int, error) { return conn.reader.Read(p) }
func (conn readOnlyConn) Write(p []byte) (int, error) { return 0, io.ErrClosedPipe }
func (conn readOnlyConn) Close() error { return conn.Close() }
func (conn readOnlyConn) LocalAddr() net.Addr { return nil }
func (conn readOnlyConn) RemoteAddr() net.Addr { return nil }
func (conn readOnlyConn) SetDeadline(t time.Time) error { return nil }
Expand Down

0 comments on commit c45aede

Please sign in to comment.