Commit e0b37cf1 authored by Franksen, Benjamin's avatar Franksen, Benjamin
Browse files

scan/ellsi: passing MSG_WAITALL has no effect for UDP

parent 9afb2f11
......@@ -226,16 +226,17 @@ static ssize_t ellsi_read(void *pvt, struct can_frame *frame) {
ellsiCanTelegram *this;
while (state->unread == 0) {
nbytes = recv(state->sock, &state->msg, sizeof(state->msg), MSG_WAITALL);
debug("ellsi_read: got cmd %d subcmd %d more bytes %d\n",
ntohl(state->msg.header.command),
ntohl(state->msg.header.subcommand),
ntohl(state->msg.header.payloadLen));
nbytes = recv(state->sock, &state->msg, sizeof(state->msg), 0);
if (nbytes < 0) {
errbuf_t buf;
fprintf(stderr, "ellsi_read: recv failed (%s)\n", ERRNO_STR(buf));
fprintf(stderr, "ellsi_read(%d): recv failed (%s)\n", state->sock, ERRNO_STR(buf));
return -1;
}
debug("ellsi_read(%d): got cmd %d subcmd %d paylod length %d\n",
state->sock,
ntohl(state->msg.header.command),
ntohl(state->msg.header.subcommand),
ntohl(state->msg.header.payloadLen));
if (state->msg.header.magic != htonl(ELLSI_MAGIC)) {
fprintf(stderr, "ellsi_read(%d): bad magic\n", state->sock);
return -1;
......@@ -302,7 +303,7 @@ static int ellsi_check(int sock) {
int r;
memset(&ack, 0, sizeof(ack));
r = recv(sock, &ack, sizeof(ack), MSG_WAITALL);
r = recv(sock, &ack, sizeof(ack), 0);
if (r < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK) {
errbuf_t buf;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment