(t time.Time)
| 246 | } |
| 247 | |
| 248 | func (this *ClientConn) SetReadDeadline(t time.Time) error { |
| 249 | // 如果开启了HTTP自动读超时选项,则自动控制超时时间 |
| 250 | if this.isHTTP && !this.isPersistent && this.autoReadTimeout { |
| 251 | this.isShortReading = false |
| 252 | |
| 253 | var unixTime = t.Unix() |
| 254 | if unixTime < 10 { |
| 255 | return nil |
| 256 | } |
| 257 | if unixTime == this.readDeadlineTime { |
| 258 | return nil |
| 259 | } |
| 260 | this.readDeadlineTime = unixTime |
| 261 | var seconds = -time.Since(t) |
| 262 | if seconds <= 0 || seconds > HTTPIdleTimeout { |
| 263 | return nil |
| 264 | } |
| 265 | if seconds < HTTPIdleTimeout-1*time.Second { |
| 266 | this.isShortReading = true |
| 267 | } |
| 268 | } |
| 269 | return this.rawConn.SetReadDeadline(t) |
| 270 | } |
| 271 | |
| 272 | func (this *ClientConn) SetWriteDeadline(t time.Time) error { |
| 273 | return this.rawConn.SetWriteDeadline(t) |
no test coverage detected