I was testing an http client that downloads a file from a server, with NO_SYS=1 and raw api. It seems works well, but I noticed pcapif_poll() doesn't return during all the download process that takes several seconds. Indeed pcapif_poll() contains a loop:

void
pcapif_poll(struct netif *netif)
{
  ...
  do {
    if (pa->adapter != NULL) {
      ret = pcap_dispatch(pa->adapter, -1, pcapif_input, (u_char*)pa);
    } else {
      ret = -1;
    }
    ...
  } while (ret > 0);
}

In NO_SYS=1 I have the classical mainloop:

while(1) {
  default_netif_poll();
  sys_check_timeouts();
  my_other_tasks();
}

So, during all the download process, mainloop is stucked in default_netif_poll() that calls pcapif_poll().

I think the loop in pcapif_poll() takes care of all the incoming packets pending in the receveing buffers, so I suspect the packets arrive faster than lwip application is capable to process them, so incoming packets are always available after every pcap_dispatch().

Maybe pcapip_poll() can be changed to call pcap_dispatch() a maximum number of times.

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to