Fix a dead lock bug

Fixed a bug that the &client->listener_mutex will be locked forever if head is NULL as if so it's locked once but never gets unlocked