clientv3/lease.go
func (l *lessor) resetRecv() (pb.Lease_LeaseKeepAliveClient, error) {
	sctx, cancel := context.WithCancel(l.stopCtx)
	stream, err := l.remote.LeaseKeepAlive(sctx, append(l.callOpts, withMax(0))...)
	if err != nil {
		cancel()
		return nil, err
	}

	l.mu.Lock()
	defer l.mu.Unlock()
	if l.stream != nil && l.streamCancel != nil {
		l.streamCancel()
	}

	l.streamCancel = cancel
	l.stream = stream

	go l.sendKeepAliveLoop(stream)
	return stream, nil
}
func (l *lessor) resetRecv() (pb.Lease_LeaseKeepAliveClient, error) {
	sctx, cancel := context.WithCancel(l.stopCtx)
	stream, err := l.remote.LeaseKeepAlive(sctx, append(l.callOpts, withMax(0))...)
	if err != nil {
		cancel()
		return nil, err
	}

	l.mu.Lock()
	defer l.mu.Unlock()
	if l.stream != nil && l.streamCancel != nil {
		l.streamCancel()
	}

	l.streamCancel = cancel
	l.stream = stream

	go l.sendKeepAliveLoop(stream)
	return stream, nil
}
func ( l * lessor ) resetRecv ( ) ( pb . Lease_LeaseKeepAliveClient , error ) { sctx , cancel := context . WithCancel ( l . stopCtx ) stream , err := l . remote . LeaseKeepAlive ( sctx , append ( l . callOpts , withMax ( 0 ) ) ... ) if err != nil { cancel ( ) return nil , err } l . mu . Lock ( ) defer l . mu . Unlock ( ) if l . stream != nil && l . streamCancel != nil { l . streamCancel ( ) } l . streamCancel = cancel l . stream = stream go l . sendKeepAliveLoop ( stream ) return stream , nil }
// resetRecv opens a new lease stream and starts sending keep alive requests.
resetRecv opens a new lease stream and starts sending keep alive requests .