ObjFW  Diff

Differences From Artifact [d088ca13d0]:

  • File src/OFTCPSocket.m — part of check-in [1f7898f109] at 2009-12-17 10:53:23 on branch trunk — Further improve OFTCPSocket.

    Only use getaddrinfo() if it's thread-safe - it does not make much
    sense to allow getaddrinfo() if it's not thread-safe, as then its
    biggest advantage to gethostbyname() is gone.

    Also, copy the result from gethostbyname() so we can release the lock
    before connecting - this should greatly improve the speed when trying
    to connect to multiple hosts without a thread-safe getaddrinfo(). (user: js, size: 7681) [annotate] [blame] [check-ins using]

To Artifact [339b99e114]:


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#ifndef HAVE_GETADDRINFO
# include <stdlib.h>
# ifndef _WIN32
#  include <arpa/inet.h>
# endif
#endif

#import "OFTCPSocket.h"
#import "OFExceptions.h"
#import "OFMacros.h"

#ifndef INVALID_SOCKET







|
|
<
<
<







12
13
14
15
16
17
18
19
20



21
22
23
24
25
26
27
#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_WIN32)
#include <netinet/in.h>



#endif

#import "OFTCPSocket.h"
#import "OFExceptions.h"
#import "OFMacros.h"

#ifndef INVALID_SOCKET