Fix the peer manager's median calculation.

The previous version was producing random crashes due to race conditions
between inserting new values and reading _sorted.  The implementation is
now changed to calculate the median on changes and cache the value.
While this hasn't introduced any locking, the reading routine median()
can now no longer see an inconsistent state.  If at the same time an
update happens, it can only either see the old or the new value, which
is both fine.
CMakeLists - removed OpenThreads section (not needed and makes compiling on CentOS not working)

Peer: only log bytes sent if actually done - i.e. dont report 0 bytes left...
seems like 'Threads ' is needed for pthread anyway (?)
post stop instead of close/cancel - close resulted in a race condition causing a deadline timer call just after a connect to leave socket unconnected when queried in VersionFilter
Removed shutdown/cancel from Peer::stop - we just rely on the destructor to clean up
enabled easy swithcing off of multithreaded verification of signatures
Fixed forgotten addition - don't flush if we are already flushing - doh! thought I had that one comitted already...
Deleted a few commented out lines from last commit
A lot of network bugfixes:
* Did not announce the right version to inbound connections - FIXED
* Did never disconnect inbound clients causing a lot of strange behaviour
* Made outbound connections more robust and fixed race conditions
fixed sql errors in getSpentOutputs and getOutputs.
fixed logic error in handle_async_block
fixed trying to access closed socket (Bad File Descriptor exception) by ensuring the socket is open before executing the actual handle_read/write
Improved the GetBlock rpc call
fixed the rpc GET command
Merge pull request #75 from domob1812/fix-median

Fix the peer manager's median calculation.
Super - thanks for fixing this - I never had the issue myself though - could be due to number of peers ?