Differences From Artifact [f2e2a2e8ce]:
- File
src/exceptions/OFAddressTranslationFailedException.m
— part of check-in
[62e2de30b9]
at
2015-02-16 08:39:17
on branch trunk
— Explicitly pass errno to exceptions
The old behaviour where the exception would access errno directly on
creation of the exception was very fragile. The two main problems with
it were that sometimes it would pick up an errno even though none had
been set and in other cases that when the exception was created errno
had already been overridden.This also greatly increases errno handling on Win32, especially in
conjunction with sockets. It can still be improved further, though. (user: js, size: 3351) [annotate] [blame] [check-ins using]
To Artifact [99c1abc7ff]:
- File src/exceptions/OFAddressTranslationFailedException.m — part of check-in [724e07f923] at 2015-02-20 18:41:40 on branch trunk — Use a mutex for gai_strerror() if necessary (user: js, size: 3710) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
119 120 121 122 123 124 125 | _host]; else return @"An address could not be translated!"; #ifndef _WIN32 } # ifdef HAVE_GETADDRINFO | > > > > > > | | | > | | | | | > > > > > > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | _host]; else return @"An address could not be translated!"; #ifndef _WIN32 } # ifdef HAVE_GETADDRINFO # if defined(OF_HAVE_THREADS) && !defined(HAVE_THREADSAFE_GETADDRINFO) if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; @try { # endif if (_host != nil) return [OFString stringWithFormat: @"The host %@ could not be translated to an " @"address: %s", _host, gai_strerror(_error)]; else return [OFString stringWithFormat: @"An address could not be translated: %s", gai_strerror(_error)]; # if defined(OF_HAVE_THREADS) && !defined(HAVE_THREADSAFE_GETADDRINFO) } @finally { if (!of_mutex_unlock(&mutex)) @throw [OFUnlockFailedException exception]; } # endif # else # ifdef OF_HAVE_THREADS if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; @try { # endif |
︙ | ︙ |