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
@@ -1,7 +1,6 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
@@ -114,8 +113,8 @@ func (s *HTTP) servHTTP(req *request, c *proxy.Conn) {
|
||||
}
|
||||
defer rc.Close()
|
||||
|
||||
buf := pool.GetWriteBuffer()
|
||||
defer pool.PutWriteBuffer(buf)
|
||||
buf := pool.GetBytesBuffer()
|
||||
defer pool.PutBytesBuffer(buf)
|
||||
|
||||
// send request to remote server
|
||||
req.WriteBuf(buf)
|
||||
@@ -133,7 +132,9 @@ func (s *HTTP) servHTTP(req *request, c *proxy.Conn) {
|
||||
}
|
||||
}()
|
||||
|
||||
r := bufio.NewReader(rc)
|
||||
r := pool.GetBufReader(rc)
|
||||
defer pool.PutBufReader(r)
|
||||
|
||||
tpr := textproto.NewReader(r)
|
||||
line, err := tpr.ReadLine()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user