{"action":"closed","issue":{"url":"https://api.github.com/repos/rhummelmose/BluetoothKit/issues/26","repository_url":"https://api.github.com/repos/rhummelmose/BluetoothKit","labels_url":"https://api.github.com/repos/rhummelmose/BluetoothKit/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/rhummelmose/BluetoothKit/issues/26/comments","events_url":"https://api.github.com/repos/rhummelmose/BluetoothKit/issues/26/events","html_url":"https://github.com/rhummelmose/BluetoothKit/issues/26","id":160001384,"number":26,"title":"Two potential bugs.","user":{"login":"Nick-The-Uncharted","id":7438737,"avatar_url":"https://avatars.githubusercontent.com/u/7438737?v=3","gravatar_id":"","url":"https://api.github.com/users/Nick-The-Uncharted","html_url":"https://github.com/Nick-The-Uncharted","followers_url":"https://api.github.com/users/Nick-The-Uncharted/followers","following_url":"https://api.github.com/users/Nick-The-Uncharted/following{/other_user}","gists_url":"https://api.github.com/users/Nick-The-Uncharted/gists{/gist_id}","starred_url":"https://api.github.com/users/Nick-The-Uncharted/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nick-The-Uncharted/subscriptions","organizations_url":"https://api.github.com/users/Nick-The-Uncharted/orgs","repos_url":"https://api.github.com/users/Nick-The-Uncharted/repos","events_url":"https://api.github.com/users/Nick-The-Uncharted/events{/privacy}","received_events_url":"https://api.github.com/users/Nick-The-Uncharted/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-13T17:18:55Z","updated_at":"2016-10-21T06:53:47Z","closed_at":"2016-10-21T06:53:47Z","body":"Thank you for writing this repo which save me a lot of time.  \r\nHere are two potential bug I came across:  \r\nFirst, `Core Bluetooth` seems to have a slight chance to call `func centralManager(central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral)` twice for a single connecting behavior.\r\nCode following may output `core bluetooth bug?` when keeping switching on and off bluetooth.\r\n\r\n```Swift\r\ninternal func centralManager(central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral) {\r\n        if self.connectionAttempts.count == 0 {\r\n            print(\"core bluetooth bug?\")\r\n        }\r\n        succeedConnectionAttempt(connectionAttemptForPeripheral(peripheral)!)\r\n    }\r\n```\r\n\r\nThe second one is that if an timeOut error occur . `failConnectionAttempt` will be called, which call `cancelPeripheralConnection` and `cancelPeripheralConnection` lead to call of `didFailToConnectPeripheral `, and when `didFailToConnectPeripheral` happen, the corresponding `connectionAttempt` is already removed and the program will crash .\r\n\r\nIMO, both of those two bug can be avoided by avoiding force unwrap result of `connectionAttemptForPeripheral`.\r\n\r\nPS: There is a good chance that I mistake something ."}}
{"actor":{"display_login":"rhummelmose"}}