Fix high CPU use on Windows when connecting to a server

When getting a write event for an EventHandler that wanted a single write only, remove it from the WriteSet (socketengine_select)

Fixes #556 reported by @WindowsUser
m_spanningtree FJOIN handler: Merge and take maxmodes into consideration when applying non-prefix modes
Prevent m_cgiirc from blocking indefinitely, resulting in registration timeouts on e.g. Mibbit when webirc is not used
Merge pull request #563 from ElementalAlchemist/patch-1

Prevent m_cgiirc from blocking indefinitely
Fix low risk crash when we can't determine maximum open socket count.
Fix the Poll socket engine on BSD.
Replace arguments for toggling socketengines  with --socketengine.
Do not send too much data over SSL in one go

Some clients fail to read it entirely and the remaining data stays in their read buffer until new data arrives
m_userip Fix incorrect "variable may be used uninitialized" warning shown by older GCC versions
Merge pull request #585 from SaberUK/master+configure-engine-selection

Replace arguments for toggling socketengines  with --socketengine.
Merge pull request #588 from SaberUK/insp20+fix-socketengines

[2.0] Fix various socket engine bugs.
Clean up error handling in threadengine_win32
Use the correct socket related error messages on Windows
m_ssl_openssl Fix inverted check that prevented certificates from being recognized as trusted
Use the preprocessor to check for TCP deferring support.
Merge pull request #587 from SaberUK/master+defer-preprocessor

Use the preprocessor to check for TCP deferring support.
Fix some warnings which are causing debug builds to fail.

- Clang: private field 'module' is not used
- GCC: suggest a space before ‘;’ or explicit braces around empty
       body in ‘while’ statement
Merge pull request #589 from SaberUK/master+fix-debug-build

Fix some warnings which are causing debug builds to fail.
Move dynamic_reference and related classes to dynref.h
Seperate ModeReference into ChanModeReference and UserModeReference