log payloads
This commit is contained in:
parent
c9c23331ca
commit
bd44330177
2 changed files with 8 additions and 5 deletions
|
@ -74,16 +74,19 @@ int on_receive_measure_packet(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
|||
struct measlat_ctx* mctx = fdinfo->cat->app_ctx;
|
||||
ssize_t nread;
|
||||
|
||||
if (mctx->mc.read_size >= mctx->mc.payload_size) mctx->mc.read_size = 0;
|
||||
if (mctx->mc.read_size >= mctx->mc.payload_size || strcmp(mctx->transport, "udp") == 0) mctx->mc.read_size = 0;
|
||||
|
||||
if (mctx->is_from_needed) nread = recvfrom(fdinfo->fd, mctx->mc.payload_rcv, mctx->mc.payload_size, MSG_TRUNC, (struct sockaddr*)&mctx->addr, &mctx->addrlen);
|
||||
else nread = recv(fdinfo->fd, mctx->mc.payload_rcv + mctx->mc.read_size, mctx->mc.payload_size - mctx->mc.read_size, 0);
|
||||
if (mctx->is_from_needed) {
|
||||
nread = recvfrom(fdinfo->fd, mctx->mc.payload_rcv, mctx->mc.payload_size, MSG_TRUNC, (struct sockaddr*)&mctx->addr, &mctx->addrlen);
|
||||
} else {
|
||||
nread = recv(fdinfo->fd, mctx->mc.payload_rcv + mctx->mc.read_size, mctx->mc.payload_size - mctx->mc.read_size, 0);
|
||||
}
|
||||
if (nread > 0) mctx->mc.read_size += nread;
|
||||
|
||||
if ((nread == -1 && errno == EAGAIN) || nread == 0) {
|
||||
return 1;
|
||||
}
|
||||
if (mctx->mc.read_size < mctx->mc.payload_size) {
|
||||
if (strcmp("udp", mctx->transport) != 0 && mctx->mc.read_size < mctx->mc.payload_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void measure_parse(int size, struct measure_conf* mc) {
|
|||
|
||||
|
||||
perror("read error, payload has wrong size");
|
||||
exit(EXIT_FAILURE);
|
||||
//exit(EXIT_FAILURE);
|
||||
}
|
||||
struct measure_packet* head = (struct measure_packet*) mc->payload_rcv;
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &curr) == -1){
|
||||
|
|
Loading…
Reference in a new issue