Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int wait_for_incoming_packet = 0; /* 1:block, 0:non blocking */
- rv = pfring_recv(ring, &b, 0, &h, wait_for_incoming_packet);
- if (rv < 0)
- return -1;
- if (rv == 0)
- {
- pfd.fd = pfring_get_selectable_fd(ring);
- pfd.events = POLLIN;
- pfd.revents = 0;
- rc = poll(&pfd, 1, ACK_FROM_NV_TIMEOUT);
- if (rc > 0) {
- rv = pfring_recv(ring, &b, 0, &h, wait_for_incoming_packet);
- /* pfring_recv() ritorna success */
- if (rv == 1) {
- if (b[42] != chunk_nr) {
- printf("-3\n");
- return -3; /* non era ACK */
- }
- else
- return 0; /* OK - ACK ricevuto */
- }
- }
- if (rc == 0) /* timeout */
- {
- printf("-2\n");
- return -2;
- }
- if (rc < 0) {
- printf("-1\n");
- return -1; /* errore ritornato da pfring_recv() */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement