Converted all use of select() to poll(), because select() is evil.

See http://beesbuzz.biz/blog/e/2013/10/10-the_problem_with_select_vs_poll.php
for a description of the issue.

This fix brings in a little bit of C++, because map and vector turn an annoying
bit of state tracking into something trivial. Technically this turns an
operation that was formerly O(n) to O(n lg n), but n remains pretty small and,
more importantly, this won't crash whenever an fd > FD_SETSIZE gets allocated
(which is possible even with the connection cap).  std::unordered_set (in
C++11) would retain O(n) characteristics, although in reality it won't make a
measurable difference.