func()

in gdbclient/internal/pool/pool.go [461:482]


func (p *ConnPool) isStaleConns(cn *ConnWebSocket) bool {
	if cn.brokenOrClosed() {
		return true
	}

	// check max age bellow
	if p.opt.MaxConnAge == 0 {
		return false
	}

	// connection in use ??
	if (atomic.LoadInt32(&cn.borrowed) != 0) || (atomic.LoadInt32(&cn.pendingSize) != 0) {
		return false
	}

	// age old enough to release
	if time.Now().Sub(cn.CreatedAt()) > p.opt.MaxConnAge {
		return true
	}

	return false
}