1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

use compact in tls writer

This commit is contained in:
Darien Raymond 2018-12-27 20:38:24 +01:00
parent c72d853454
commit 41b1ac192e
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -15,18 +15,13 @@ var (
type conn struct {
*tls.Conn
mergingWriter *buf.BufferedWriter
}
func (c *conn) WriteMultiBuffer(mb buf.MultiBuffer) error {
if c.mergingWriter == nil {
c.mergingWriter = buf.NewBufferedWriter(buf.NewWriter(c.Conn))
}
if err := c.mergingWriter.WriteMultiBuffer(mb); err != nil {
return err
}
return c.mergingWriter.Flush()
mb = buf.Compact(mb)
mb, err := buf.WriteMultiBuffer(c, mb)
buf.ReleaseMulti(mb)
return err
}
func (c *conn) HandshakeAddress() net.Address {