call sf_localize_errno in sf_proto_extract_header

connection_manager
YuQing 2021-01-07 15:40:23 +08:00
parent c0128c0f15
commit 1f95bdf89b
2 changed files with 17 additions and 1 deletions

View File

@ -243,7 +243,6 @@ static inline int sf_send_and_check_response_header(ConnectionInfo *conn,
return result;
}
if ((result=sf_check_response(conn, response, network_timeout,
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->flags = buff2short(header_proto->flags);
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,

View File

@ -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);
#ifdef __cplusplus