mirror of
https://github.com/curl/curl.git
synced 2026-06-30 22:09:09 +03:00
replace switch cases with the new macro
This commit is contained in:
parent
ffb99912ac
commit
b0ccea9358
2 changed files with 13 additions and 26 deletions
|
|
@ -939,30 +939,19 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
|||
static CURLcode socket_connect_result(struct Curl_easy *data,
|
||||
const char *ipaddress, int error)
|
||||
{
|
||||
switch(error) {
|
||||
case SOCKEINPROGRESS:
|
||||
case SOCKEWOULDBLOCK:
|
||||
#if !defined(USE_WINSOCK) && EAGAIN != SOCKEWOULDBLOCK
|
||||
/* On some platforms EAGAIN and EWOULDBLOCK are the
|
||||
* same value, and on others they are different, hence
|
||||
* the odd #if
|
||||
*/
|
||||
case EAGAIN:
|
||||
#endif
|
||||
if(SOCK_EWOULDBLOCK_EAGAIN(error) || error == SOCKEINPROGRESS)
|
||||
return CURLE_OK;
|
||||
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
{
|
||||
VERBOSE(char buffer[STRERROR_LEN]);
|
||||
infof(data, "Immediate connect fail for %s: %s", ipaddress,
|
||||
curlx_strerror(error, buffer, sizeof(buffer)));
|
||||
NOVERBOSE((void)ipaddress);
|
||||
}
|
||||
data->state.os_errno = error;
|
||||
/* connect failed */
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
{
|
||||
VERBOSE(char buffer[STRERROR_LEN]);
|
||||
infof(data, "Immediate connect fail for %s: %s", ipaddress,
|
||||
curlx_strerror(error, buffer, sizeof(buffer)));
|
||||
NOVERBOSE((void)ipaddress);
|
||||
}
|
||||
data->state.os_errno = error;
|
||||
/* connect failed */
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
struct cf_socket_ctx {
|
||||
|
|
|
|||
|
|
@ -165,12 +165,10 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
|
|||
;
|
||||
|
||||
if(!curlx_sztouz(rv, psent)) {
|
||||
switch(SOCKERRNO) {
|
||||
case SOCKEWOULDBLOCK:
|
||||
#if !defined(USE_WINSOCK) && EAGAIN != SOCKEWOULDBLOCK
|
||||
case EAGAIN:
|
||||
#endif
|
||||
int err = SOCKERRNO;
|
||||
if(SOCK_EWOULDBLOCK_EAGAIN(err))
|
||||
return CURLE_AGAIN;
|
||||
switch(err) {
|
||||
case SOCKEMSGSIZE:
|
||||
/* UDP datagram is too large; caused by PMTUD. Let it be lost. */
|
||||
*psent = pktlen;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue