|
From: | Chris_S |
Subject: | Re: [lwip-users] Problem with NULL pcb->callback_arg |
Date: | Thu, 06 Aug 2009 07:21:07 -0700 |
Yes I can confirm that you need to check for the NULL.
Arg=NULL shows up regularly in normal http processing after the connection is
closed, and the alloc mem for hs (arg) gets released. At least that's what
I see in my server code, but it is somewhat dependent on how the other callback
functions are of course written as well.
There are several problems with the httpd that is in
contrib.
Here is the code I use in my httpd for
http_sent().
Chris.
-----
static err_t http_sent(void *arg, struct tcp_pcb *pcb, u16_t
len) {
struct http_state *hs; LWIP_UNUSED_ARG(len); hs = arg; // assign the http_state struct if(hs==NULL) { DEBUG_PRINT("http_sent hs=NULL 0x%08x %d\n", pcb, len); return (ERR_OK); } DEBUG_PRINT("http_sent %s 0x%08x %d\n", hs->PFileSysEntry->name, pcb, len); hs->retries = 0; // Temporarily disable send notifications tcp_sent(pcb, NULL); // send more data send_data(pcb, hs); // Reenable notifications. tcp_sent(pcb, http_sent); return (ERR_OK); } ---
|
[Prev in Thread] | Current Thread | [Next in Thread] |