Fixed issue with background polling thread not getting deleted.

Every time the user loses connection and gets it back it spawned a new thread because calling [[NSRunLoop currentRunLoop] run] would run forever.

1. Added semaphore so when we want to stop the thread we just call dispatch_semaphore_signal.
2. Fixed memory leaks when allocating dictionaries and not releasing them.

We really need to think about the polling times....not sure what kind of approach we need to take.