mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
pool: added bufio.Reader pool
This commit is contained in:
1 parent
c15c55fe05
commit
417ac556f7
29 files changed
+188
-168
No files matched your search
@@ -32,7 +32,7 @@ func (s *HTTP) Dial(network, addr string) (net.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf := pool.GetWriteBuffer()
|
||||
buf := pool.GetBytesBuffer()
|
||||
buf.WriteString("CONNECT " + addr + " HTTP/1.1\r\n")
|
||||
buf.WriteString("Host: " + addr + "\r\n")
|
||||
buf.WriteString("Proxy-Connection: Keep-Alive\r\n")
|
||||
@@ -45,7 +45,7 @@ func (s *HTTP) Dial(network, addr string) (net.Conn, error) {
|
||||
// header ended
|
||||
buf.WriteString("\r\n")
|
||||
_, err = rc.Write(buf.Bytes())
|
||||
pool.PutWriteBuffer(buf)
|
||||
pool.PutBytesBuffer(buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user