~ubuntu-branches/ubuntu/raring/curl/raring-updates

« back to all changes in this revision

Viewing changes to lib/connect.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2011-11-13 21:07:32 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 55.
  • Revision ID: package-import@ubuntu.com-20111113210732-bk5n25x2tu7aplur
Tags: upstream-7.22.0
ImportĀ upstreamĀ versionĀ 7.22.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "setup.h"
24
24
 
25
 
#ifdef HAVE_SYS_TIME_H
26
 
#include <sys/time.h>
27
 
#endif
28
25
#ifdef HAVE_SYS_SOCKET_H
29
26
#include <sys/socket.h>
30
27
#endif
52
49
#ifdef HAVE_ARPA_INET_H
53
50
#include <arpa/inet.h>
54
51
#endif
55
 
#ifdef HAVE_STDLIB_H
56
 
#include <stdlib.h>
57
 
#endif
58
52
 
59
53
#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE))
60
54
#include <sys/filio.h>
68
62
#include <inet.h>
69
63
#endif
70
64
 
71
 
#include <stdio.h>
72
 
#include <errno.h>
73
 
#include <string.h>
74
 
 
75
65
#define _MPRINTF_REPLACE /* use our functions only */
76
66
#include <curl/mprintf.h>
77
67
 
669
659
 
670
660
  *connected = FALSE; /* a very negative world view is best */
671
661
 
672
 
  if(conn->bits.tcpconnect) {
 
662
  if(conn->bits.tcpconnect[sockindex]) {
673
663
    /* we are connected already! */
674
664
    *connected = TRUE;
675
665
    return CURLE_OK;
708
698
      if(code)
709
699
        return code;
710
700
 
711
 
      conn->bits.tcpconnect = TRUE;
 
701
      conn->bits.tcpconnect[sockindex] = TRUE;
712
702
      *connected = TRUE;
713
 
      Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
 
703
      if(sockindex == FIRSTSOCKET)
 
704
        Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
714
705
      Curl_verboseconnect(conn);
715
706
      Curl_updateconninfo(conn, sockfd);
716
707
 
756
747
#ifdef TCP_NODELAY
757
748
  struct SessionHandle *data= conn->data;
758
749
  curl_socklen_t onoff = (curl_socklen_t) data->set.tcp_nodelay;
759
 
  int proto = IPPROTO_TCP;
 
750
  int level = IPPROTO_TCP;
760
751
 
761
752
#if 0
762
753
  /* The use of getprotobyname() is disabled since it isn't thread-safe on
768
759
     detected. */
769
760
  struct protoent *pe = getprotobyname("tcp");
770
761
  if(pe)
771
 
    proto = pe->p_proto;
 
762
    level = pe->p_proto;
772
763
#endif
773
764
 
774
 
  if(setsockopt(sockfd, proto, TCP_NODELAY, (void *)&onoff,
 
765
  if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,
775
766
                sizeof(onoff)) < 0)
776
767
    infof(data, "Could not set TCP_NODELAY: %s\n",
777
768
          Curl_strerror(conn, SOCKERRNO));
799
790
          Curl_strerror(conn, SOCKERRNO));
800
791
}
801
792
#else
802
 
#define nosigpipe(x,y)
 
793
#define nosigpipe(x,y) Curl_nop_stmt
803
794
#endif
804
795
 
805
 
#ifdef WIN32
 
796
#ifdef USE_WINSOCK
806
797
/* When you run a program that uses the Windows Sockets API, you may
807
798
   experience slow performance when you copy data to a TCP server.
808
799