Fix Odd use of time.Duration (#29)
Ref - https://github.com/appscode/g2/issues/28
This commit is contained in:
parent
f2f0349d2d
commit
d0e6ec4878
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultTimeout time.Duration = 1000
|
DefaultTimeout time.Duration = time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// One client connect to one server.
|
// One client connect to one server.
|
||||||
@ -25,7 +25,7 @@ type Client struct {
|
|||||||
conn net.Conn
|
conn net.Conn
|
||||||
rw *bufio.ReadWriter
|
rw *bufio.ReadWriter
|
||||||
|
|
||||||
ResponseTimeout time.Duration // response timeout for do() in ms
|
ResponseTimeout time.Duration // response timeout for do()
|
||||||
|
|
||||||
ErrorHandler ErrorHandler
|
ErrorHandler ErrorHandler
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ func (client *Client) do(funcname string, data []byte,
|
|||||||
client.innerHandler.remove("c")
|
client.innerHandler.remove("c")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var timer = time.After(client.ResponseTimeout * time.Millisecond)
|
var timer = time.After(client.ResponseTimeout)
|
||||||
select {
|
select {
|
||||||
case ret := <-result:
|
case ret := <-result:
|
||||||
return ret.handle, ret.err
|
return ret.handle, ret.err
|
||||||
|
Loading…
Reference in New Issue
Block a user