SocketManager: do not block if tasks are runnable

Reviewer: @carlroth

I saw flow deletion, which I recently converted to a task, taking far too long
(50 - 100 ms). It turned out that if a task yielded it would not be scheduled
until the next event (timer or socket), at which point we would check the task
list again. The simple fix is to not go to sleep if there are tasks we can run.

Added a new unit test that would have caught this.