controller: serialize calls to socket.sendall

The sendall method is not atomic. Concurrent calls may end up with their data
interleaved on the socket. This is especially likely when the socket buffer
fills up, causing sendall to call select(2) between writes.

I noticed this bug when installing many flows. The echo reply sent by the
controller thread ended up in the middle of a flow mod.
1 file changed