Skip to content

Commit

Permalink
gs: Comments should end in a period
Browse files Browse the repository at this point in the history
  • Loading branch information
onizmx committed Jun 10, 2024
1 parent 6da5328 commit 4ddf47c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
8 changes: 3 additions & 5 deletions pkg/gatewayserver/io/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (c *Connection) HandleUp(up *ttnpb.UplinkMessage, frontendSync *FrontendClo

case gpsTime != nil:
gatewayTime := *ttnpb.StdTime(gpsTime)
// Bryan: up.Settings.Timestamp is tmst, check udp/translation.go v1Metadata and v2Metadata
// Bryan: up.Settings.Timestamp is tmst, check udp/translation.go v1Metadata and v2Metadata.
ct = c.scheduler.SyncWithGatewayAbsolute(up.Settings.Timestamp, receivedAt, gatewayTime)
log.FromContext(c.ctx).WithFields(log.Fields(
"timestamp", up.Settings.Timestamp,
Expand All @@ -319,11 +319,9 @@ func (c *Connection) HandleUp(up *ttnpb.UplinkMessage, frontendSync *FrontendClo
"gateway_time", gatewayTime,
)).Debug("Synchronized server and gateway absolute time")

// Bryan: gpsTime will be nil if
// Bryan: * tmms is not provided
// Bryan: * tmms is invalid (check where gpsTimeDelta is used)
// Bryan: gpsTime will be nil when tmms is not provided, or tmms is invalid (check where gpsTimeDelta is used).
case gpsTime == nil:
// Bryan: up.Settings.Timestamp is tmst, check udp/translation.go v1Metadata and v2Metadata
// Bryan: up.Settings.Timestamp is tmst, check udp/translation.go v1Metadata and v2Metadata.
ct = c.scheduler.Sync(up.Settings.Timestamp, receivedAt)
log.FromContext(c.ctx).WithFields(log.Fields(
"timestamp", up.Settings.Timestamp,
Expand Down
4 changes: 2 additions & 2 deletions pkg/gatewayserver/scheduling/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func (c *RolloverClock) Sync(timestamp uint32, server time.Time) ConcentratorTim
c.absolute = (ConcentratorTime(rollovers<<32) + ConcentratorTime(timestamp)) * ConcentratorTime(time.Microsecond)
c.relative = timestamp
c.server = &server
// Bryan: when gateway gps time is not set or invalid, this sync function will clear gateway gps time
// Bryan: when gateway gps time is not set or invalid, this sync function will clear gateway gps time.
c.gateway = nil
c.synced = true
return c.absolute
}

// SyncWithGatewayAbsolute synchronizes the clock with the given concentrator timestamp, the server time and the
// absolute gateway time that corresponds to the given timestamp.
// Bryan: this function still syncs with tmst but caching gateway gps time
// Bryan: this function still syncs with tmst but caching gateway gps time.
func (c *RolloverClock) SyncWithGatewayAbsolute(timestamp uint32, server, gateway time.Time) ConcentratorTime {
ct := c.Sync(timestamp, server)
c.gateway = &gateway
Expand Down
13 changes: 2 additions & 11 deletions pkg/gatewayserver/scheduling/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,13 @@ func (s *Scheduler) ScheduleAt(ctx context.Context, opts Options) (res Emission,
if !ok {
panic("clock is synced without server time")
}
// Bryan: opts.time is absolute time and only set for Class B and C
// Bryan: check gatewayserver/io ScheduleDown
// Bryan: opts.time is absolute time and only set for Class B and C, check gatewayserver/io ScheduleDown.
if opts.Time != nil {
var ok bool
starts, ok = s.clock.FromGatewayTime(*ttnpb.StdTime(opts.Time))
if !ok {
// Bryan: we can simply fail here to block all Class B and C transmission when gateway gps time is nil in clock.go
// Bryan: we can simply fail here to block all Class B and C transmission when gateway gps time is nil in clock.go.

Check failure on line 324 in pkg/gatewayserver/scheduling/scheduler.go

View workflow job for this annotation

GitHub Actions / Code Quality

line is 121 characters (lll)
return Emission{}, 0, errNoAbsoluteGatewayTime.New()
// if medianRTT == nil {
// return Emission{}, 0, errNoAbsoluteGatewayTime.New()
// }
// serverTime, ok := s.clock.FromServerTime(*ttnpb.StdTime(opts.Time))
// if !ok {
// return Emission{}, 0, errNoServerTime.New()
// }
// starts = serverTime - ConcentratorTime(*medianRTT/2)
}
} else {
starts = s.clock.FromTimestampTime(opts.Timestamp)
Expand Down

0 comments on commit 4ddf47c

Please sign in to comment.