mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Add ReadCopy
This commit is contained in:
parent
4438e3b21b
commit
b27a0743b6
|
|
@ -383,6 +383,15 @@ func (c *Conduit) Read(b []byte) (int, error) {
|
||||||
return c.conn.Read(b)
|
return c.conn.Read(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conduit) ReadCopy() ([]byte, error) {
|
||||||
|
var buf [65535 * 2]byte
|
||||||
|
n, err := c.conn.Read(buf[:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return buf[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Conduit) Write(b []byte) (int, error) {
|
func (c *Conduit) Write(b []byte) (int, error) {
|
||||||
return c.conn.Write(b)
|
return c.conn.Write(b)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue