Fixed race where pending connections were being added without holding mutex - this allowed the same pending connections to be cleared concurrently in another thread which led to segfaults and hangs.