mesos/spark — pull request #791 by pwendell (2013-08-07 22:37:42+00:00)
Title: Fix race condition in ConnectionManager.

This fixes a race condition in the ConnectionManager.

The specific condition involves write channels. There is a race where a new message was added to a channel while an existing message was being written. Depending on the order of thread scheduling, it was possible for the ongoing write handler to disable the write interest on the FD and it have it never get properly re-enabled.

This code simplifies the write path a bit in a way that also removes the race. I've put it here for testing, please don't merge yet.