I have been using libcurl (7.19.4) to write code for a Nokia N97 device which
runs the Symbian 5th edition software. This has gone well considering how
little I knew about libcurl (just used the curl command line utility in the
past to good effect) and Symbian (I didn't know anything about it before I did
this project) with one exception that I've worked around. It appears to be a
bug in the open-c layer that ultimately talks to the underlying Symbian o/s. I
pass this on simply to alert others although if anyone has suggestions on how
to further debug this or alternative workarounds they would be gratefully
accepted.
The problem arises when first using libcurl and seems to be a timing issue
between open-c and the underlying o/s. In connect.c, the function
singleipconnect, connect fails on the first call when I do my first HTTP
request using the easy interface. The code goes through to the case EAGAIN and
calls waitconnect(). waitconnect() returns with a WAITCONN_FDSET_ERROR.
I added the following, admittedly fairly silly, code to work around this issue.
This code path only happens the first time singleipconnect is called and seems
to never happen again.
#ifdef SYMBIAN
if (rc == WAITCONN_FDSET_ERROR)
{
// FIXME:
// On Nokia N97, waitconnect may not do the wait if sockets are not
ready (?!!)
// it was observed that adding delay fixes the problem
int delay = 1000;
infof(data, " waitconnect returned %d, waiting %d ms to repeat", rc,
delay);
wait_ms(delay);
rc = waitconnect(sockfd, timeout_ms);
}
#endif
The second call to waitconnect in this #ifdef works. I had tried shorter wait
times and they worked but I wanted to ensure that this problem wouldn't occur
at all so I bumped the time up to 1 second. I was hoping to get a newer version
of the firmware to try this against to see if the problem goes away but haven't
seen a newer version up to this point.
That's all I've tracked down up to this point. It was somewhat difficult to
track down because when I was stepping through with the debugger I'd effect the
timing and the problem would disappear.