Fixes connection handling. Changed libev from c++ wrapper to plain c