perror("read");
exit(1);
}
- return SEND;
+ return STORE_ONLY;
}
void init_read(struct in_ctx *ctx)
s = CHECK(socket(PF_CAN, SOCK_RAW, CAN_RAW));
+ int rcvbuf = 25000; /* Limit rcvbuf to not have so big queueing latencies */
+ CHECK(setsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)));
+
if (nonblocking) {
int flags = CHECK(fcntl(s, F_GETFL, 0));
CHECK(fcntl(s, F_SETFL, flags | O_NONBLOCK));
{
volatile struct tpacket2_hdr *hdr = ctx->ptr + ctx->current*FRAME_SIZE;
- if (ctx->from_in == NOP)
+ if (ctx->from_in == NOP) {
+ CHECK(send(ctx->s, NULL, 0, 0));
return 0;
+ }
while (hdr->tp_status != TP_STATUS_AVAILABLE) {
CHECK(send(ctx->s, NULL, 0, 0));