rhummelmose / BluetoothKit

Easily communicate between iOS/OSX devices using BLE
Other
2.27k stars 267 forks source link

BKPeer sendData, tasks get stuck when the sendDataTasks array hold more than 1 task. #77

Open ericwastaken opened 7 years ago

ericwastaken commented 7 years ago

The code in BKPeer.swift, sendData is as follows after a task is added to the sendDataTasks array

if sendDataTasks.count == 1 {
            processSendDataTasks()
        }

This processes the tasks if there's exactly 1 task in that array. Unfortunately, when you have multiple peers and/or you're sending a several data tasks, the array will grow past 1 and the processSendDataTasks() is never called.

The code should be:

if sendDataTasks.count >= 1 {
            processSendDataTasks()
        }

I'll follow this with a PR to address it.

Thanks,

Eric.