fix: add MSG_WAITALL flag for recv function
This commit is contained in:
parent
cb9f5da339
commit
6fdc283cc4
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-08-09 03:16+0300\n"
|
||||
"POT-Creation-Date: 2024-08-09 03:26+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -98,5 +98,6 @@ bool lm_mptp_client_recv(int sock, lm_mptp_t *packet) {
|
||||
return false; // error set by function
|
||||
}
|
||||
|
||||
pdebug_binary((char*)&packet->header, sizeof(packet->header));
|
||||
return true;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ void lm_mptp_copy(lm_mptp_t *dst, lm_mptp_t *src) {
|
||||
}
|
||||
|
||||
bool lm_mptp_recv(int sock, lm_mptp_t *packet) {
|
||||
if (recv(sock, &packet->header, sizeof(packet->header), 0) <= 0) {
|
||||
if (recv(sock, &packet->header, sizeof(packet->header), MSG_WAITALL) <= 0) {
|
||||
if (ETIMEDOUT == errno || EAGAIN == errno) {
|
||||
lm_error_set(LM_ERR_MPTPTimeout);
|
||||
return false;
|
||||
@ -235,7 +235,7 @@ bool lm_mptp_recv(int sock, lm_mptp_t *packet) {
|
||||
// packet->header.data_size = ntohs(packet->header.data_size);
|
||||
|
||||
if (packet->header.host_size <= MPTP_HOST_MAX && packet->header.host_size != 0){
|
||||
if(recv(sock, packet->host, packet->header.host_size, 0) <= 0){
|
||||
if(recv(sock, packet->host, packet->header.host_size, MSG_WAITALL) <= 0){
|
||||
if (ETIMEDOUT == errno || EAGAIN == errno) {
|
||||
lm_error_set(LM_ERR_MPTPTimeout);
|
||||
return false;
|
||||
@ -246,7 +246,7 @@ bool lm_mptp_recv(int sock, lm_mptp_t *packet) {
|
||||
}
|
||||
|
||||
if (packet->header.data_size <= MPTP_DATA_MAX && packet->header.data_size != 0){
|
||||
if(recv(sock, packet->data, packet->header.data_size, 0) <= 0){
|
||||
if(recv(sock, packet->data, packet->header.data_size, MSG_WAITALL) <= 0){
|
||||
if (ETIMEDOUT == errno || EAGAIN == errno) {
|
||||
lm_error_set(LM_ERR_MPTPTimeout);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user