Skip to content

Commit

Permalink
snet: expose setting buffer sizes for benefit of quic
Browse files Browse the repository at this point in the history
  • Loading branch information
matzf committed Jul 3, 2024
1 parent 9472354 commit 7441cde
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions pkg/snet/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ func (c *Conn) SyscallConn() (syscall.RawConn, error) {
return c.conn.SyscallConn()
}

func (c *Conn) SetReadBuffer(n int) error {
c.conn.SetReadBuffer(n)
return nil
}

func (c *Conn) SetWriteBuffer(n int) error {
c.conn.SetWriteBuffer(n)
return nil
}

func (c *Conn) SetDeadline(t time.Time) error {
if err := c.scionConnReader.SetReadDeadline(t); err != nil {
return err
Expand Down
10 changes: 6 additions & 4 deletions pkg/snet/packet_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type PacketConn interface {
SetWriteDeadline(t time.Time) error
SetDeadline(t time.Time) error
SyscallConn() (syscall.RawConn, error)
SetReadBuffer(int) error
SetWriteBuffer(int) error
LocalAddr() net.Addr
Close() error
}
Expand Down Expand Up @@ -104,10 +106,6 @@ type SCIONPacketConn struct {
interfaceMap interfaceMap
}

func (c *SCIONPacketConn) SetReadBuffer(bytes int) error {
return c.Conn.SetReadBuffer(bytes)
}

func (c *SCIONPacketConn) SetDeadline(d time.Time) error {
return c.Conn.SetDeadline(d)
}
Expand Down Expand Up @@ -153,6 +151,10 @@ func (c *SCIONPacketConn) SyscallConn() (syscall.RawConn, error) {
return c.Conn.SyscallConn()
}

func (c *SCIONPacketConn) SetReadBuffer(n int) error {
return c.Conn.SetReadBuffer(n)
}

func (c *SCIONPacketConn) readFrom(pkt *Packet) (*net.UDPAddr, error) {
pkt.Prepare()
n, remoteAddr, err := c.Conn.ReadFrom(pkt.Bytes)
Expand Down

0 comments on commit 7441cde

Please sign in to comment.