~ubuntu-branches/ubuntu/gutsy/curl/gutsy

« back to all changes in this revision

Viewing changes to lib/hostthre.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-29 15:04:24 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060629150424-pn00qumt9sml8p4m
Tags: 7.15.4-1ubuntu1
Synchronize to Debian. Only change left: Removal of stunnel and
libdb4.2-dev build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: hostthre.c,v 1.33 2005/11/24 20:39:00 bagder Exp $
 
21
 * $Id: hostthre.c,v 1.36 2006-04-26 17:23:28 giva Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
26
26
#include <string.h>
27
27
#include <errno.h>
28
28
 
29
 
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
 
29
#ifdef HAVE_MALLOC_H
30
30
#include <malloc.h>
31
 
#else
 
31
#endif
32
32
#ifdef HAVE_SYS_TYPES_H
33
33
#include <sys/types.h>
34
34
#endif
55
55
#include <inet.h>
56
56
#include <stdlib.h>
57
57
#endif
58
 
#endif
59
58
 
60
59
#ifdef HAVE_SETJMP_H
61
60
#include <setjmp.h>
62
61
#endif
63
62
 
64
 
#ifdef WIN32
65
 
#include <stdlib.h>
 
63
#ifdef HAVE_PROCESS_H
66
64
#include <process.h>
67
65
#endif
68
66
 
78
76
#include "share.h"
79
77
#include "strerror.h"
80
78
#include "url.h"
 
79
#include "multiif.h"
81
80
 
82
81
#define _MPRINTF_REPLACE /* use our functions only */
83
82
#include <curl/mprintf.h>
300
299
  struct thread_sync_data tsd = { 0,0,0,NULL };
301
300
  if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
302
301
    /* thread synchronization data initialization failed */
303
 
    return -1;
 
302
    return (unsigned)-1;
304
303
  }
305
304
 
306
305
  /* Sharing the same _iob[] element with our parent thread should
569
568
  thread_and_event[1] = td->event_thread_started;
570
569
  if (WaitForMultipleObjects(sizeof(thread_and_event) /
571
570
                             sizeof(thread_and_event[0]),
572
 
                             thread_and_event, FALSE,
 
571
                             (const HANDLE*)thread_and_event, FALSE,
573
572
                             INFINITE) == WAIT_FAILED) {
574
573
    /* The resolver thread has been created,
575
574
     * most probably it works now - ignoring this "minor" error
715
714
  return CURLE_OK;
716
715
}
717
716
 
718
 
CURLcode Curl_resolv_fdset(struct connectdata *conn,
719
 
                           fd_set *read_fd_set,
720
 
                           fd_set *write_fd_set,
721
 
                           int *max_fdp)
 
717
int Curl_resolv_getsock(struct connectdata *conn,
 
718
                        curl_socket_t *socks,
 
719
                        int numsocks)
722
720
{
723
721
  const struct thread_data *td =
724
722
    (const struct thread_data *) conn->async.os_specific;
725
723
 
726
724
  if (td && td->dummy_sock != CURL_SOCKET_BAD) {
727
 
    FD_SET(td->dummy_sock,write_fd_set);
728
 
    *max_fdp = (int)td->dummy_sock;
 
725
    if(numsocks) {
 
726
      /* return one socket waiting for writable, even though this is just
 
727
         a dummy */
 
728
      socks[0] = td->dummy_sock;
 
729
      return GETSOCK_WRITESOCK(0);
 
730
    }
729
731
  }
730
 
  (void) read_fd_set;
731
 
  return CURLE_OK;
 
732
  return 0;
732
733
}
733
734
 
734
735
#ifdef CURLRES_IPV4