Improve the performance of the MDS thread by emptying the receive buffers between each call to poll(). Also investigate if using edge-triggered epoll() will give additional performance improvement (not guaranteed since we are only polling three file descriptors).
Diff: