Commit 7425db3f authored by Kamil Dudka's avatar Kamil Dudka
Browse files

simplify code of Curl_resolv_timeout()

parent 64ac64e7
Loading
Loading
Loading
Loading
+64 −64
Original line number Diff line number Diff line
@@ -564,12 +564,15 @@ int Curl_resolv_timeout(struct connectdata *conn,
  else
    timeout = timeoutms;

  if(timeout && timeout < 1000)
  if(!timeout)
    /* USE_ALARM_TIMEOUT defined, but no timeout actually requested */
    return Curl_resolv(conn, hostname, port, entry);

  if(timeout < 1000)
    /* The alarm() function only provides integer second resolution, so if
       we want to wait less than one second we must bail out already now. */
    return CURLRESOLV_TIMEDOUT;

  if (timeout > 0) {
  /*************************************************************
   * Set signal handler to catch SIGALRM
   * Store the old value to be able to set it back later!
@@ -608,7 +611,6 @@ int Curl_resolv_timeout(struct connectdata *conn,
    rc = CURLRESOLV_ERROR;
    goto clean_up;
  }
  }

#else
#ifndef CURLRES_ASYNCH
@@ -627,7 +629,6 @@ int Curl_resolv_timeout(struct connectdata *conn,
#ifdef USE_ALARM_TIMEOUT
clean_up:

  if (timeout > 0) {
  if(!prev_alarm)
    /* deactivate a possibly active alarm before uninstalling the handler */
    alarm(0);
@@ -667,7 +668,6 @@ clean_up:
    else
      alarm((unsigned int)alarm_set);
  }
  }
#endif /* USE_ALARM_TIMEOUT */

  return rc;