Commit db623cb4 authored by Seblu's avatar Seblu

last version of sll

parent 8783b155
......@@ -144,11 +144,12 @@ void Connection::connect(const char *addr, int port) {
// connect
if (::connect(socket_fd_, (struct sockaddr *) &daddr, sizeof daddr) == -1) {
int errno__ = errno;
disconnect_();
pthread_mutex_unlock(&w_mutex_);
pthread_mutex_unlock(&r_mutex_);
pthread_mutex_unlock(&c_mutex_);
throw Error(ERR_NET, (string) "Unable to connect to " + addr + ": " + hstrerror(h_errno));
throw Error(ERR_NET, (string) "Unable to connect to " + addr + ": " + strerror(errno__));
}
// set infos
......@@ -308,7 +309,7 @@ void Connection::send(const char* buf, size_t len) {
pthread_mutex_unlock(&r_mutex_);
pthread_mutex_unlock(&c_mutex_);
pthread_mutex_unlock(&r_mutex_);
if (errno__ == ECONNRESET)// || errno__ == EPIPE)
if (errno__ == ECONNRESET || errno__ == EPIPE)
throw Error(ERR_NET, "Connection reset by peer");
else
throw Error(ERR_NET, "send: " + (string) strerror(errno__));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment