call sf_localize_errno in sf_proto_extract_header
parent
c0128c0f15
commit
1f95bdf89b
|
|
@ -243,7 +243,6 @@ static inline int sf_send_and_check_response_header(ConnectionInfo *conn,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((result=sf_check_response(conn, response, network_timeout,
|
if ((result=sf_check_response(conn, response, network_timeout,
|
||||||
expect_cmd)) != 0)
|
expect_cmd)) != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -291,6 +290,9 @@ static inline void sf_proto_extract_header(SFCommonProtoHeader *header_proto,
|
||||||
header_info->body_len = buff2int(header_proto->body_len);
|
header_info->body_len = buff2int(header_proto->body_len);
|
||||||
header_info->flags = buff2short(header_proto->flags);
|
header_info->flags = buff2short(header_proto->flags);
|
||||||
header_info->status = buff2short(header_proto->status);
|
header_info->status = buff2short(header_proto->status);
|
||||||
|
if (header_info->status > 255) {
|
||||||
|
header_info->status = sf_localize_errno(header_info->status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int sf_active_test(ConnectionInfo *conn,
|
static inline int sf_active_test(ConnectionInfo *conn,
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,20 @@ static inline int sf_unify_errno(const int errnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int sf_localize_errno(const int errnum)
|
||||||
|
{
|
||||||
|
switch (errnum) {
|
||||||
|
case SF_ERROR_EINVAL:
|
||||||
|
return EINVAL;
|
||||||
|
case SF_ERROR_EAGAIN:
|
||||||
|
return EAGAIN;
|
||||||
|
case SF_ERROR_EOVERFLOW:
|
||||||
|
return EOVERFLOW;
|
||||||
|
default:
|
||||||
|
return errnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char *sf_strerror(const int errnum);
|
const char *sf_strerror(const int errnum);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue