Skip to content

Commit

Permalink
Additional InstanceID usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Nov 19, 2017
1 parent 3f6ae8c commit 9e42769
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/HAP/Endpoints/Protocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ enum Protocol {
let components = string.components(separatedBy: ".")
guard
components.count == 2,
let aid = Int(components[0]),
let iid = Int(components[1])
let aid = InstanceID(components[0]),
let iid = InstanceID(components[1])
else {
throw DecodeError.invalidPath
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/HAP/Server/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public class Device {
// which is the data-type we wanted to use here. We can change it back
// to UInt64 once the following commit has made it into a release:
// https://github.com/apple/swift-corelibs-foundation/commit/64b67c91479390776c43a96bd31e4e85f106d5e1
var idGenerator = (1...Int.max).makeIterator()
var idGenerator = (1...InstanceID.max).makeIterator()
for accessory in accessories {
accessory.device = self
accessory.aid = idGenerator.next()!
Expand Down
2 changes: 1 addition & 1 deletion Sources/HAP/Server/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private let minimalTimeBetweenNotifications: DispatchTimeInterval = .seconds(1)
public class Server: NSObject, NetServiceDelegate {

class NotificationQueue {
private var queue = [Int: Characteristic]()
private var queue = [InstanceID: Characteristic]()
fileprivate weak var listener: Connection?
private var nextAllowableNotificationTime = DispatchTime.now()

Expand Down

0 comments on commit 9e42769

Please sign in to comment.