예제 #1
0
파일: asyn-ares.c 프로젝트: curl/curl
static void Curl_ares_sock_state_cb(void *data, ares_socket_t socket_fd,
                                    int readable, int writable)
{
  struct Curl_easy *easy = data;
  if(!readable && !writable) {
    DEBUGASSERT(easy);
    Curl_multi_closed(easy, socket_fd);
  }
}
예제 #2
0
파일: connect.c 프로젝트: m-deckel/curl
/*
 * Close a socket.
 *
 * 'conn' can be NULL, beware!
 */
int Curl_closesocket(struct connectdata *conn,
                      curl_socket_t sock)
{
  if(conn && conn->fclosesocket) {
    if((sock == conn->sock[SECONDARYSOCKET]) &&
       conn->sock_accepted[SECONDARYSOCKET])
      /* if this socket matches the second socket, and that was created with
         accept, then we MUST NOT call the callback but clear the accepted
         status */
      conn->sock_accepted[SECONDARYSOCKET] = FALSE;
    else {
      Curl_multi_closed(conn, sock);
      return conn->fclosesocket(conn->closesocket_client, sock);
    }
  }

  if(conn)
    /* tell the multi-socket code about this */
    Curl_multi_closed(conn, sock);

  sclose(sock);

  return 0;
}