bitcoin/bitcoin — pull request #2583 by laanwj (2013-04-27 13:44:52+00:00)
Title: netbase: fix !O_NONBLOCK where ~O_NONBLOCK was meant

Using ! on a non-zero value will always return 0, so the statement is currently ineffective.

If this is not what is meant, the respective code in ConnectSocketDirectly to set the socket back to blocking should be removed entirely, as it currently behaves differently for windows and linux.

Also remove some duplicate and superfluous code in other places.