1- package gofcgi
1+ package pkg
22
33import (
44 "errors"
@@ -38,12 +38,12 @@ func NewClient(network string, address string) *Client {
3838 expireTime : time .Now ().Add (86400 * time .Second ),
3939 }
4040
41- // 处理超时
41+ // deal with expireTime
4242 go func () {
4343 for {
4444 time .Sleep (1 * time .Second )
4545 if time .Since (client .expireTime ) > 0 {
46- client .conn .Close ()
46+ _ = client .conn .Close ()
4747
4848 client .expireLocker .Lock ()
4949 client .expireTime = time .Now ().Add (86400 * time .Second )
@@ -77,7 +77,7 @@ func (this *Client) Call(req *Request) (resp *http.Response, stderr []byte, err
7777
7878 defer func () {
7979 if this .mock {
80- time .Sleep (1 * time .Second ) // 模拟占用连接
80+ time .Sleep (1 * time .Second )
8181 }
8282 this .isFree = true
8383 this .locker .Unlock ()
@@ -93,12 +93,12 @@ func (this *Client) Call(req *Request) (resp *http.Response, stderr []byte, err
9393 resp , stderr , err = req .CallOn (this .conn )
9494 this .endTime ()
9595
96- // 如果失去连接,则重新连接
96+ // if lost connection, retry
9797 if err != nil {
9898 log .Println ("[gofcgi]" + err .Error ())
9999
100100 if err == ErrClientDisconnect {
101- // 重试一次
101+ // retry again
102102 this .Close ()
103103 err = this .Connect ()
104104 if err == nil {
@@ -120,15 +120,15 @@ func (this *Client) Call(req *Request) (resp *http.Response, stderr []byte, err
120120func (this * Client ) Close () {
121121 this .isAvailable = false
122122 if this .conn != nil {
123- this .conn .Close ()
123+ _ = this .conn .Close ()
124124 }
125125 this .conn = nil
126126}
127127
128128func (this * Client ) Connect () error {
129129 this .isAvailable = false
130130
131- // @TODO 设置并使用超时时间
131+ // @TODO set timeout
132132 conn , err := net .Dial (this .network , this .address )
133133 if err != nil {
134134 log .Println ("[gofcgi]" + err .Error ())
0 commit comments