mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-20 08:39:14 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edcf60c7a5 |
@@ -91,7 +91,7 @@ func (h *HunkReaderWriter) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if cap(h.buf) >= buf.Size {
|
||||
if len(h.buf) == buf.Size {
|
||||
b := h.buf
|
||||
h.index = len(h.buf)
|
||||
return buf.MultiBuffer{buf.NewExisted(b)}, nil
|
||||
|
||||
@@ -74,14 +74,10 @@ func (h *MultiHunkReaderWriter) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if cap(b) >= buf.Size {
|
||||
if len(b) == buf.Size {
|
||||
mb = append(mb, buf.NewExisted(b))
|
||||
} else {
|
||||
nb := buf.New()
|
||||
nb.Extend(int32(len(b)))
|
||||
copy(nb.Bytes(), b)
|
||||
|
||||
mb = append(mb, nb)
|
||||
mb = buf.MergeBytes(mb, b)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,13 +103,6 @@ func (c *UConn) Close() error {
|
||||
return c.Conn.Close()
|
||||
}
|
||||
|
||||
func (c *UConn) HandshakeContext(ctx context.Context) error {
|
||||
// Chrome の default handshake timeout
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
return c.UConn.HandshakeContext(ctx)
|
||||
}
|
||||
|
||||
func (c *UConn) HandshakeContextServerName(ctx context.Context) string {
|
||||
if err := c.HandshakeContext(ctx); err != nil {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user