Pull emit loop from synchronized to prevent deadlock on socket block