Commit db623cb4 authored by Seblu's avatar Seblu
Browse files

last version of sll

parent 8783b155
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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__));