|
@@ -1372,19 +1372,9 @@ func (d *Device) SubscribeTelemetry(resume uint64, peer string) (*telemetry.Snap
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *Device) SubscribeEvents(resume uint64, peer string) (*telemetry.EventSub, []*hthv1.Event, *hthv1.Event, error) {
|
|
func (d *Device) SubscribeEvents(resume uint64, peer string) (*telemetry.EventSub, []*hthv1.Event, *hthv1.Event, error) {
|
|
|
- sub, replay, gap, err := d.hub.SubscribeEventsPeer(resume, peer)
|
|
|
|
|
- if gap != nil && gap.EventId == 0 {
|
|
|
|
|
- gap.EventId = d.store.NextEventID()
|
|
|
|
|
- if gap.EventId == 0 {
|
|
|
|
|
- gap.EventId = 1
|
|
|
|
|
- }
|
|
|
|
|
- now := d.clk.Now()
|
|
|
|
|
- gap.WallTime = timestamppb.New(now)
|
|
|
|
|
- gap.MonotonicNs = d.clk.MonotonicNS()
|
|
|
|
|
- gap.DeviceId = d.id
|
|
|
|
|
- gap.LastContiguousEventId = resume
|
|
|
|
|
- }
|
|
|
|
|
- return sub, replay, gap, err
|
|
|
|
|
|
|
+ // Gap descriptors must not consume a global event_id. SubscribeEventsPeer
|
|
|
|
|
+ // attaches delivery_gap onto the next real event (or first replay event).
|
|
|
|
|
+ return d.hub.SubscribeEventsPeer(resume, peer)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (d *Device) AcquireLease(ctx context.Context, holder string, ttl time.Duration) (*hthv1.ControlLease, error) {
|
|
func (d *Device) AcquireLease(ctx context.Context, holder string, ttl time.Duration) (*hthv1.ControlLease, error) {
|