Compare commits

..
Author SHA1 Message Date
Fangliding edcf60c7a5 gRPC: Pass standard size buffer 2026-11-19 20:51:41 +08:00
3 changed files with 3 additions and 14 deletions
+1 -1
View File
@@ -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)
}
}
-7
View File
@@ -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 ""