1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

socket: use pre-allocated buffers to avoid dynamic allocations and syscalls in critical path

This commit is contained in:
Steffen Vogel 2018-11-02 14:55:36 +01:00
parent 2f37227861
commit e3b522c39b

View file

@ -471,12 +471,12 @@ int socket_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *
retry: ret = io_sprint(&s->io, s->out.buf, s->out.buflen, &wbytes, smps, cnt);
if (ret < 0) {
warn("Failed to format payload: reason=%d", ret);
warning("Failed to format payload: reason=%d", ret);
return ret;
}
if (wbytes == 0) {
warn("Failed to format payload: wbytes=%zu", wbytes);
warning("Failed to format payload: wbytes=%zu", wbytes);
return -1;
}
@ -524,7 +524,7 @@ retry2: bytes = sendto(s->sd, s->out.buf, wbytes, 0, (struct sockaddr *) &s->rem
}
if (bytes != wbytes)
warning("Partial send to node %s", node_name(n));
warning("Partial sendto() to node %s", node_name(n));
return cnt;
}