MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / SetReadDeadline

Method SetReadDeadline

internal/nodes/client_conn.go:248–270  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

246}
247
248func (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
272func (this *ClientConn) SetWriteDeadline(t time.Time) error {
273 return this.rawConn.SetWriteDeadline(t)

Callers 1

setHTTPReadTimeoutMethod · 0.95

Calls 1

UnixMethod · 0.80

Tested by

no test coverage detected