lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] lwip win32 port: pcapif_poll() doesn't return


From: Giuseppe Modugno
Subject: [lwip-users] lwip win32 port: pcapif_poll() doesn't return
Date: Sat, 15 Apr 2023 01:38:00 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]