What is the maximum block time caused by gethostbyname? I was under the impression that this is defined by ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME however I am getting blocks at least twice this time. The blocks happen when the network is down, but I would like some idea how to estimate or reduce this time.
I was under the impression that this is defined by ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME
however I am getting blocks at least twice this time
The DNS requests are sent repeatedly, up to ipconfigDNS_REQUEST_ATTEMPTS times.
Have you defined this macro? It defaults to:
/* The maximum number of times a DNS request should be
sent out if a response is not received, before giving up. */
#ifndef ipconfigDNS_REQUEST_ATTEMPTS
#define ipconfigDNS_REQUEST_ATTEMPTS 5
#endif
Looking at the code for byname_a, it would appear to fall through to prvGetHostByName anyway, so how does this avoid blocking?
prvGetHostByName() will be called in a non-blocking way because the parameter xReadTimeOut_ms has been set to zero.
If you are using the latest FreeRTOS+TCP from github, unfortunately, FreeRTOS_gethostbyname_a() will not work properly.
Also, I am getting an exception when I call FreeRTOS_gethostbyname_cancel(&somevar) at vListInsertEnd.
Another problem, why isn’t dhcpDNS_SERVER_OPTIONS_CODE in the ucDHCPRequestOptions on line 907? It seems that this should rather be defined in the headers as an option.
It is a pointer which has only meaning to the application, for instance a pointer to an object.
Also, I am getting an exception when I call FreeRTOS_gethostbyname_cancel(&somevar) at vListInsertEnd.
FreeRTOS_gethostbyname_cancel() calls vDNSCheckCallBack(), which will call uxListRemove().
You’re saying that you see an exception occurring in vListInsertEnd(). I don’t see how it can get there?
why isn’t dhcpDNS_SERVER_OPTIONS_CODE in the ucDHCPRequestOptions[]
on line 907?
It seems that this should rather be defined in the headers as an option.
The DNS server option is already included in ucDHCPDiscoverOptions[].
Would you like to make this configurable?
I won’t claim to completely understand how the list is implemented, but the stackpointer location at the crash crash pointed me to this being caused somehow by my use of either FreeRTOS_gethostbyname_a or FreeRTOS_gethostbyname_cancel. I figured it had something to do with calling these with a parameter rather than letting it time out, and the list getting removed twice perhaps.
I’ll do some more digging here on the DHCP, I should have started a different thread for that. I am having trouble getting dns settings through dhcp from a sonicwall tz105.
Erik, could it be that you’re calling FreeRTOS_gethostbyname_a() before the network it up?
I mean, before vIPNetworkUpCalls() is called?
If so, the list that gathers the call-backs has not been initialised by vDNSInitialise() yet.