summaryrefslogtreecommitdiff
path: root/nuttx/netutils/thttpd
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-09-13 00:12:09 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-09-13 00:12:09 +0000
commitfda86dc1720d46a26badfc033efd6a2f25bbdff7 (patch)
treebcdceee726698cd8f7c2cc9a6b1eeacc8c624a38 /nuttx/netutils/thttpd
parent3e27ac2c3d4ae76bd4412bc7dd44a2d5c3a7b478 (diff)
downloadpx4-nuttx-fda86dc1720d46a26badfc033efd6a2f25bbdff7.tar.gz
px4-nuttx-fda86dc1720d46a26badfc033efd6a2f25bbdff7.tar.bz2
px4-nuttx-fda86dc1720d46a26badfc033efd6a2f25bbdff7.zip
Remove last remnants of SYLOGging
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2043 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/netutils/thttpd')
-rw-r--r--nuttx/netutils/thttpd/fdwatch.c22
-rw-r--r--nuttx/netutils/thttpd/fdwatch.h6
-rwxr-xr-xnuttx/netutils/thttpd/httpd_alloc.c68
-rwxr-xr-xnuttx/netutils/thttpd/httpd_alloc.h10
-rw-r--r--nuttx/netutils/thttpd/libhttpd.c71
-rw-r--r--nuttx/netutils/thttpd/libhttpd.h6
-rw-r--r--nuttx/netutils/thttpd/thttpd.c102
-rw-r--r--nuttx/netutils/thttpd/timers.c47
-rw-r--r--nuttx/netutils/thttpd/timers.h8
9 files changed, 81 insertions, 259 deletions
diff --git a/nuttx/netutils/thttpd/fdwatch.c b/nuttx/netutils/thttpd/fdwatch.c
index 77e1318c3..1933d1d6d 100644
--- a/nuttx/netutils/thttpd/fdwatch.c
+++ b/nuttx/netutils/thttpd/fdwatch.c
@@ -64,10 +64,6 @@
* Private Data
****************************************************************************/
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-static long nwatches = 0;
-#endif
-
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@@ -259,10 +255,6 @@ int fdwatch(struct fdwatch_s *fw, long timeout_msecs)
int ret;
int i;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- nwatches++;
-#endif
-
/* Wait for activity on any of the desciptors. When poll() returns, ret
* will hold the number of descriptors with activity (or zero on a timeout
* or <0 on an error.
@@ -344,19 +336,5 @@ void *fdwatch_get_next_client_data(struct fdwatch_s *fw)
return fw->client[fw->next++];
}
-/* Generate debugging statistics ndbg message. */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-void fdwatch_logstats(struct fdwatch_s *fw, long secs)
-{
- fdwatch_dump("LOG stats:", fw);
- if (secs > 0)
- {
- ndbg("fdwatch - %ld polls (%g/sec)\n", nwatches, (float)nwatches / secs);
- }
- nwatches = 0;
-}
-#endif
-
#endif /* CONFIG_THTTPD */
diff --git a/nuttx/netutils/thttpd/fdwatch.h b/nuttx/netutils/thttpd/fdwatch.h
index 144badbda..3aa701c14 100644
--- a/nuttx/netutils/thttpd/fdwatch.h
+++ b/nuttx/netutils/thttpd/fdwatch.h
@@ -107,11 +107,5 @@ extern int fdwatch_check_fd(struct fdwatch_s *fw, int fd);
extern void *fdwatch_get_next_client_data(struct fdwatch_s *fw);
-/* Generate debugging statistics syslog message. */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-extern void fdwatch_logstats(struct fdwatch_s *fw, long secs);
-#endif
-
#endif /* __NETUTILS_THTTPD_FDWATCH_H */
diff --git a/nuttx/netutils/thttpd/httpd_alloc.c b/nuttx/netutils/thttpd/httpd_alloc.c
index 6f132f166..f3504993f 100755
--- a/nuttx/netutils/thttpd/httpd_alloc.c
+++ b/nuttx/netutils/thttpd/httpd_alloc.c
@@ -65,16 +65,41 @@
* Private Data
****************************************************************************/
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
+#ifdef CONFIG_THTTPD_MEMDEBUG
static int g_nallocations = 0;
static size_t g_allocated = 0;
#endif
/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Generate debugging statistics */
+
+#ifdef CONFIG_THTTPD_MEMDEBUG
+void httpd_memstats(void)
+{
+ static struct mallinfo mm;
+
+ ndbg("%d allocations (%lu bytes)\n", g_nallocations, (unsigned long)g_allocated);
+
+ /* Get the current memory usage */
+
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ mm = mallinfo();
+#else
+ (void)mallinfo(&mm);
+#endif
+ ndbg("arena: %08x ordblks: %08x mxordblk: %08x uordblks: %08x fordblks: %08x\n",
+ mm.arena, mm.ordblks, mm.mxordblk, mm.uordblks, mm.fordblks);
+}
+#endif
+
+/****************************************************************************
* Global Functions
****************************************************************************/
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
+#ifdef CONFIG_THTTPD_MEMDEBUG
FAR void *httpd_malloc(size_t nbytes)
{
void *ptr = malloc(nbytes);
@@ -84,20 +109,16 @@ FAR void *httpd_malloc(size_t nbytes)
}
else
{
-#ifdef CONFIG_THTTPD_MEMDEBUG
nvdbg("Allocated %d bytes at %p\n", nbytes, ptr);
-#endif
g_nallocations++;
g_allocated += nbytes;
}
-#ifdef CONFIG_THTTPD_MEMDEBUG
httpd_memstats();
-#endif
return ptr;
}
#endif
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
+#ifdef CONFIG_THTTPD_MEMDEBUG
FAR void *httpd_realloc(FAR void *oldptr, size_t oldsize, size_t newsize)
{
void *ptr = realloc(oldptr, newsize);
@@ -108,27 +129,21 @@ FAR void *httpd_realloc(FAR void *oldptr, size_t oldsize, size_t newsize)
}
else
{
-#ifdef CONFIG_THTTPD_MEMDEBUG
nvdbg("Re-allocated form %d to %d bytes (from %p to %p)\n",
oldsize, newsize, oldptr, ptr);
-#endif
g_allocated += (newsize - oldsize);
}
-#ifdef CONFIG_THTTPD_MEMDEBUG
httpd_memstats();
-#endif
return ptr;
}
#endif
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
+#ifdef CONFIG_THTTPD_MEMDEBUG
void httpd_free(FAR void *ptr)
{
free(ptr);
-#ifdef CONFIG_THTTPD_MEMDEBUG
nvdbg("Freed memory at %p\n", ptr);
httpd_memstats();
-#endif
}
#endif
@@ -160,29 +175,4 @@ void httpd_realloc_str(char **pstr, size_t *maxsize, size_t size)
}
}
-/* Generate debugging statistics */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-void httpd_memstats(void)
-{
-#ifdef CONFIG_THTTPD_MEMDEBUG
- static struct mallinfo mm;
-#endif
-
- ndbg("%d allocations (%lu bytes)\n", g_nallocations, (unsigned long)g_allocated);
-
- /* Get the current memory usage */
-
-#ifdef CONFIG_THTTPD_MEMDEBUG
-#ifdef CONFIG_CAN_PASS_STRUCTS
- mm = mallinfo();
-#else
- (void)mallinfo(&mm);
-#endif
- ndbg("arena: %08x ordblks: %08x mxordblk: %08x uordblks: %08x fordblks: %08x\n",
- mm.arena, mm.ordblks, mm.mxordblk, mm.uordblks, mm.fordblks);
-#endif
-}
-#endif
-
#endif /* CONFIG_THTTPD */
diff --git a/nuttx/netutils/thttpd/httpd_alloc.h b/nuttx/netutils/thttpd/httpd_alloc.h
index dd687a583..c3b3eb27e 100755
--- a/nuttx/netutils/thttpd/httpd_alloc.h
+++ b/nuttx/netutils/thttpd/httpd_alloc.h
@@ -51,7 +51,7 @@
/* Allows all memory management calls to be intercepted */
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
+#ifdef CONFIG_THTTPD_MEMDEBUG
extern FAR void *httpd_malloc(size_t nbytes);
extern FAR void *httpd_realloc(FAR void *oldptr, size_t oldsize, size_t newsize);
extern void httpd_free(FAR void *ptr);
@@ -70,13 +70,5 @@ extern void httpd_free(FAR void *ptr);
extern void httpd_realloc_str(char **pstr, size_t *maxsizeP, size_t size);
-/* Generate debugging statistics */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-extern void httpd_memstats(void);
-#else
-# define httpd_memstats()
-#endif
-
#endif /* CONFIG_THTTPD */
#endif /* __NETUTILS_THTTPD_HTTDP_ALLOC_H */
diff --git a/nuttx/netutils/thttpd/libhttpd.c b/nuttx/netutils/thttpd/libhttpd.c
index 1a7c22744..ee2a74e81 100644
--- a/nuttx/netutils/thttpd/libhttpd.c
+++ b/nuttx/netutils/thttpd/libhttpd.c
@@ -213,11 +213,11 @@ static size_t sockaddr_len(httpd_sockaddr *saP);
* Private Data
****************************************************************************/
-/* This global keeps track of whether we are in the main process or a
- * sub-process. The reason is that httpd_write_response() can get called
- * in either context; when it is called from the main process it must use
+/* This global keeps track of whether we are in the main task or a
+ * sub-task. The reason is that httpd_write_response() can get called
+ * in either context; when it is called from the main task it must use
* non-blocking I/O to avoid stalling the server, but when it is called
- * from a sub-process it wants to use blocking I/O so that the whole
+ * from a sub-task it wants to use blocking I/O so that the whole
* response definitely gets written. So, it checks this variable. A bit
* of a hack but it seems to do the right thing.
*/
@@ -1696,7 +1696,7 @@ static void cgi_kill2(ClientData client_data, struct timeval *nowP)
pid = (pid_t) client_data.i;
if (kill(pid, SIGKILL) == 0)
{
- ndbg("hard-killed CGI process %d\n", pid);
+ ndbg("hard-killed CGI task %d\n", pid);
}
}
@@ -1707,7 +1707,7 @@ static void cgi_kill(ClientData client_data, struct timeval *nowP)
pid = (pid_t) client_data.i;
if (kill(pid, SIGINT) == 0)
{
- ndbg("killed CGI process %d\n", pid);
+ ndbg("killed CGI task %d\n", pid);
/* In case this isn't enough, schedule an uncatchable kill. */
@@ -1764,7 +1764,7 @@ static void ls_child(int argc, char **argv)
/* Open a stdio stream so that we can use fprintf, which is more
* efficient than a bunch of separate write()s. We don't have to
* worry about double closes or file descriptor leaks cause we're
- * in a subprocess.
+ * in a sub-task.
*/
fp = fdopen(hc->conn_fd, "w");
@@ -2065,9 +2065,9 @@ static int ls(httpd_conn *hc)
}
closedir(dirp);
- ndbg("spawned indexing process %d for directory '%s'\n", child, hc->expnfilename);
+ ndbg("spawned indexing task %d for directory '%s'\n", child, hc->expnfilename);
- /* Schedule a kill for the child process, in case it runs too long */
+ /* Schedule a kill for the child task, in case it runs too long */
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0
client_data.i = child;
@@ -2096,7 +2096,7 @@ static int ls(httpd_conn *hc)
/* Set up environment variables. Be real careful here to avoid
* letting malicious clients overrun a buffer. We don't have
- * to worry about freeing stuff since we're a sub-process.
+ * to worry about freeing stuff since we're a sub-task.
*/
#ifdef CONFIG_THTTPD_CGI_PATTERN
@@ -2343,10 +2343,10 @@ static inline int cgi_interpose_input(httpd_conn *hc, int wfd, char *buffer)
/* Special hack to deal with broken browsers that send a LF or CRLF
* after POST data, causing TCP resets - we just read and discard up
* to 2 bytes. Unfortunately this doesn't fix the problem for CGIs
- * which avoid the interposer process due to their POST data being
- * short. Creating an interposer process for all POST CGIs is
+ * which avoid the interposer task due to their POST data being
+ * short. Creating an interposer task for all POST CGIs is
* unacceptably expensive. The eventual fix will come when interposing
- * gets integrated into the main loop as a tasklet instead of a process.
+ * gets integrated into the main loop as a tasklet instead of a task.
*/
/* Turn on no-delay mode in case we previously cleared it. */
@@ -2620,7 +2620,7 @@ static inline int cgi_interpose_output(httpd_conn *hc, int rfd, char *inbuffer,
}
#endif
-/* CGI child process. */
+/* CGI child task. */
#ifdef CONFIG_THTTPD_CGI_PATTERN
static int cgi_child(int argc, char **argv)
@@ -2645,6 +2645,12 @@ static int cgi_child(int argc, char **argv)
int ret;
int err = 1;
+ /* Use low-level debug out (because the low-level output may survive closing
+ * all file descriptors
+ */
+
+ nllvdbg("Started: %s\n", argv[1]);
+
/* Update all of the environment variable settings, these will be inherited
* by the CGI task.
*/
@@ -2659,6 +2665,7 @@ static int cgi_child(int argc, char **argv)
* stderr and hc->conn_fd
*/
+ nllvdbg("Closing all descriptors\n");
for (fd = 0; fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS); fd++)
{
/* Keep stderr open for debug; keep hc->conn_fd open for obvious reasons */
@@ -2672,15 +2679,15 @@ static int cgi_child(int argc, char **argv)
/* Create pipes that will be interposed between the CGI task's stdin or
* stdout and the socket.
*
- *
* Setup up the STDIN pipe - a pipe to transfer data received on the
* socket to the CGI program.
*/
+ nllvdbg("Create STDIN pipe\n");
ret = pipe(pipefd);
if (ret < 0)
{
- ndbg("STDIN pipe: %d\n", errno);
+ nlldbg("STDIN pipe: %d\n", errno);
goto errout_with_descriptors;
}
else
@@ -2692,7 +2699,7 @@ static int cgi_child(int argc, char **argv)
ret = dup2(pipefd[0], 0);
if (ret < 0)
{
- ndbg("STDIN dup2: %d\n", errno);
+ nlldbg("STDIN dup2: %d\n", errno);
close(pipefd[1]);
goto errout_with_descriptors;
}
@@ -2707,10 +2714,11 @@ static int cgi_child(int argc, char **argv)
if (ret == 0)
{
+ nllvdbg("Create STDOUT pipe\n");
ret = pipe(pipefd);
if (ret < 0)
{
- ndbg("STDOUT pipe: %d\n", errno);
+ nlldbg("STDOUT pipe: %d\n", errno);
goto errout_with_descriptors;
}
else
@@ -2722,10 +2730,10 @@ static int cgi_child(int argc, char **argv)
ret = dup2(pipefd[1], 1);
if (ret < 0)
{
- ndbg("STDOUT dup2: %d\n", errno);
+ nlldbg("STDOUT dup2: %d\n", errno);
close(pipefd[1]);
goto errout_with_descriptors;
- }
+ }
rfd = pipefd[0];
close(pipefd[1]);
@@ -2762,14 +2770,14 @@ static int cgi_child(int argc, char **argv)
httpd_realloc_str(&hdr.buffer, &hdr.size, 500);
if (!hdr.buffer)
{
- ndbg("hdr allocation failed\n");
+ nlldbg("hdr allocation failed\n");
goto errout_with_descriptors;
}
buffer = (char*)httpd_malloc(CONFIG_THTTPD_IOBUFFERSIZE);
if (!buffer)
{
- ndbg("buffer allocation failed\n");
+ nlldbg("buffer allocation failed\n");
goto errout_with_header;
}
@@ -2778,28 +2786,29 @@ static int cgi_child(int argc, char **argv)
fw = fdwatch_initialize(2);
if (!fw)
{
- ndbg("fdwatch allocation failed\n");
+ nlldbg("fdwatch allocation failed\n");
goto errout_with_buffer;
}
/* Run the CGI program. */
+ nllvdbg("Starting CGI\n");
child = exec(binary, (FAR const char **)argp, g_thttpdsymtab, g_thttpdnsymbols);
if (child < 0)
{
/* Something went wrong. */
- ndbg("execve %s: %d\n", hc->expnfilename, errno);
+ nlldbg("execve %s: %d\n", hc->expnfilename, errno);
goto errout_with_watch;
}
- /* Schedule a kill for the child process, in case it runs too long. */
+ /* Schedule a kill for the child task in case it runs too long. */
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0
client_data.i = child;
if (tmr_create(NULL, cgi_kill, client_data, CONFIG_THTTPD_CGI_TIMELIMIT * 1000L, 0) == NULL)
{
- ndbg("tmr_create(cgi_kill child) failed\n");
+ nlldbg("tmr_create(cgi_kill child) failed\n");
goto errout_with_watch;
}
#endif
@@ -2814,6 +2823,7 @@ static int cgi_child(int argc, char **argv)
indone = FALSE;
outdone = FALSE;
+ nllvdbg("Interposing\n");
do
{
(void)fdwatch(fw, 5000);
@@ -2822,6 +2832,7 @@ static int cgi_child(int argc, char **argv)
{
/* Transfer data from the client to the CGI program (POST) */
+ nllvdbg("Interpose input\n");
indone = cgi_interpose_input(hc, wfd, buffer);
if (indone)
{
@@ -2833,6 +2844,7 @@ static int cgi_child(int argc, char **argv)
{
/* Handle receipt of headers and CGI program response (GET) */
+ nllvdbg("Interpose output\n");
outdone = cgi_interpose_output(hc, rfd, buffer, &hdr);
}
}
@@ -2861,6 +2873,7 @@ errout_with_descriptors:
INTERNALERROR("errout");
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
httpd_write_response(hc);
+ nllvdbg("Return %d\n", ret);
return err;
}
#endif /* CONFIG_THTTPD_CGI_PATTERN */
@@ -2909,7 +2922,7 @@ static int cgi(httpd_conn *hc)
return -1;
}
- ndbg("started CGI process %d for file '%s'\n", child, hc->expnfilename);
+ ndbg("Started CGI task %d for file '%s'\n", child, hc->expnfilename);
hc->status = 200;
hc->bytes_sent = CONFIG_THTTPD_CGI_BYTECOUNT;
@@ -3184,7 +3197,7 @@ void httpd_unlisten(httpd_server * hs)
void httpd_write_response(httpd_conn *hc)
{
- /* If we are in a sub-process, turn off no-delay mode. */
+ /* If we are in a sub-task, turn off no-delay mode. */
if (main_thread != getpid())
{
@@ -4108,7 +4121,7 @@ int httpd_parse_request(httpd_conn *hc)
return 0;
}
-void httpd_close_conn(httpd_conn *hc, struct timeval *nowP)
+void httpd_close_conn(httpd_conn *hc)
{
if (hc->file_fd >= 0)
{
diff --git a/nuttx/netutils/thttpd/libhttpd.h b/nuttx/netutils/thttpd/libhttpd.h
index 159b4fbdd..6b1ee0d7d 100644
--- a/nuttx/netutils/thttpd/libhttpd.h
+++ b/nuttx/netutils/thttpd/libhttpd.h
@@ -296,11 +296,9 @@ extern int httpd_start_request(httpd_conn *hc, struct timeval *nowP);
extern void httpd_write_response(httpd_conn *hc);
-/* Call this to close down a connection and free the data.
- * If you don't have a current timeval handy just pass in 0.
- */
+/* Call this to close down a connection and free the data. */
-extern void httpd_close_conn(httpd_conn *hc, struct timeval *nowP);
+extern void httpd_close_conn(httpd_conn *hc);
/* Call this to de-initialize a connection struct and *really* free the
* mallocced strings.
diff --git a/nuttx/netutils/thttpd/thttpd.c b/nuttx/netutils/thttpd/thttpd.c
index b1e90b6c7..693e141eb 100644
--- a/nuttx/netutils/thttpd/thttpd.c
+++ b/nuttx/netutils/thttpd/thttpd.c
@@ -112,13 +112,6 @@ static struct fdwatch_s *fw;
* Public Data
****************************************************************************/
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-time_t start_time;
-time_t stats_time;
-long stats_connections;
-off_t stats_bytes;
-#endif
-
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@@ -130,19 +123,11 @@ static void handle_send(struct connect_s *conn, struct timeval *tv);
static void handle_linger(struct connect_s *conn, struct timeval *tv);
static void finish_connection(struct connect_s *conn, struct timeval *tv);
static void clear_connection(struct connect_s *conn, struct timeval *tv);
-static void really_clear_connection(struct connect_s *conn, struct timeval *tv);
+static void really_clear_connection(struct connect_s *conn);
static void idle(ClientData client_data, struct timeval *nowP);
static void linger_clear_connection(ClientData client_data, struct timeval *nowP);
static void occasional(ClientData client_data, struct timeval *nowP);
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-static void logstats(struct timeval *nowP);
-static void thttpd_logstats(long secs);
-#else
-# define logstats(nowP)
-# define thttpd_logstats(secs)
-#endif
-
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -150,15 +135,12 @@ static void thttpd_logstats(long secs);
static void shut_down(void)
{
int cnum;
- struct timeval tv;
- (void)gettimeofday(&tv, NULL);
- logstats(&tv);
for (cnum = 0; cnum < AVAILABLE_FDS; ++cnum)
{
if (connects[cnum].conn_state != CNST_FREE)
{
- httpd_close_conn(connects[cnum].hc, &tv);
+ httpd_close_conn(connects[cnum].hc);
}
if (connects[cnum].hc != NULL)
@@ -267,10 +249,6 @@ static int handle_newconnect(struct timeval *tv, int listen_fd)
httpd_set_ndelay(conn->hc->conn_fd);
fdwatch_add_fd(fw, conn->hc->conn_fd, conn);
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- ++stats_connections;
-#endif
}
}
@@ -520,7 +498,7 @@ static void handle_linger(struct connect_s *conn, struct timeval *tv)
if (ret <= 0)
{
- really_clear_connection(conn, tv);
+ really_clear_connection(conn);
}
}
@@ -583,17 +561,13 @@ static void clear_connection(struct connect_s *conn, struct timeval *tv)
/* Either we are done lingering, we shouldn't linger, or we failed to setup the linger */
- really_clear_connection(conn, tv);
+ really_clear_connection(conn);
}
-static void really_clear_connection(struct connect_s *conn, struct timeval *tv)
+static void really_clear_connection(struct connect_s *conn)
{
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- stats_bytes += conn->hc->bytes_sent;
-#endif
-
fdwatch_del_fd(fw, conn->hc->conn_fd);
- httpd_close_conn(conn->hc, tv);
+ httpd_close_conn(conn->hc);
if (conn->linger_timer != NULL)
{
tmr_cancel(conn->linger_timer);
@@ -645,7 +619,7 @@ static void linger_clear_connection(ClientData client_data, struct timeval *nowP
nvdbg("Clear connection\n");
conn = (struct connect_s *) client_data.p;
conn->linger_timer = NULL;
- really_clear_connection(conn, nowP);
+ really_clear_connection(conn);
}
static void occasional(ClientData client_data, struct timeval *nowP)
@@ -653,57 +627,6 @@ static void occasional(ClientData client_data, struct timeval *nowP)
tmr_cleanup();
}
-/* Generate debugging statistics ndbg messages for all packages */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-static void logstats(struct timeval *nowP)
-{
- struct timeval tv;
- time_t now;
- long up_secs;
- long stats_secs;
-
- if (!nowP)
- {
- (void)gettimeofday(&tv, NULL);
- nowP = &tv;
- }
-
- now = nowP->tv_sec;
- up_secs = now - start_time;
- stats_secs = now - stats_time;
- if (stats_secs == 0)
- {
- stats_secs = 1; /* fudge */
- }
-
- stats_time = now;
- ndbg("up %ld seconds, stats for %ld seconds\n", up_secs, stats_secs);
-
- thttpd_logstats(stats_secs);
- httpd_memstats();
- fdwatch_logstats(fw, stats_secs);
- tmr_logstats(stats_secs);
-}
-#endif
-
-/* Generate debugging statistics */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-static void thttpd_logstats(long secs)
-{
- if (secs > 0)
- {
- ndbg("thttpd - %ld connections (%g/sec) %lld bytes (%g/sec)\n",
- stats_connections, (float)stats_connections / secs,
- (sint64) stats_bytes, (float)stats_bytes / secs);
- }
-
- stats_connections = 0;
- stats_bytes = 0;
-}
-#endif
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -800,17 +723,6 @@ int thttpd_main(int argc, char **argv)
}
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- {
- struct timeval ts;
- gettimeofday(&ts, NULL);
- start_time = ts.tv_sec;
- stats_time = ts.tv_sec;
- stats_connections = 0;
- stats_bytes = 0;
- }
-#endif
-
/* Initialize our connections table */
connects = NEW(struct connect_s, AVAILABLE_FDS);
diff --git a/nuttx/netutils/thttpd/timers.c b/nuttx/netutils/thttpd/timers.c
index 6b56c6b2a..e03570f6a 100644
--- a/nuttx/netutils/thttpd/timers.c
+++ b/nuttx/netutils/thttpd/timers.c
@@ -60,11 +60,6 @@
static Timer *timers[HASH_SIZE];
static Timer *free_timers;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-static int alloc_count;
-static int active_count;
-static int free_count;
-#endif
/****************************************************************************
* Public Data
@@ -191,11 +186,6 @@ void tmr_init(void)
}
free_timers = NULL;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- alloc_count = 0;
- active_count = 0;
- free_count = 0;
-#endif
}
Timer *tmr_create(struct timeval *now, TimerProc *timer_proc,
@@ -207,9 +197,6 @@ Timer *tmr_create(struct timeval *now, TimerProc *timer_proc,
{
tmr = free_timers;
free_timers = tmr->next;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- --free_count;
-#endif
}
else
{
@@ -218,9 +205,6 @@ Timer *tmr_create(struct timeval *now, TimerProc *timer_proc,
{
return NULL;
}
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- alloc_count++;
-#endif
}
tmr->timer_proc = timer_proc;
@@ -249,9 +233,6 @@ Timer *tmr_create(struct timeval *now, TimerProc *timer_proc,
/* Add the new timer to the proper active list. */
l_add(tmr);
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- active_count++;
-#endif
nvdbg("Return: %p\n", tmr);
return tmr;
@@ -354,17 +335,11 @@ void tmr_cancel(Timer *tmr)
/* Remove it from its active list. */
l_remove(tmr);
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- active_count--;
-#endif
/* And put it on the free list. */
tmr->next = free_timers;
free_timers = tmr;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- free_count++;
-#endif
tmr->prev = NULL;
}
@@ -376,13 +351,7 @@ void tmr_cleanup(void)
{
tmr = free_timers;
free_timers = tmr->next;
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- free_count--;
-#endif
httpd_free((void*)tmr);
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
- alloc_count--;
-#endif
}
}
@@ -399,19 +368,3 @@ void tmr_destroy(void)
}
tmr_cleanup();
}
-
-/* Generate debugging statistics. */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-void tmr_logstats(long secs)
-{
- ndbg("timers - %d allocated, %d active, %d free",
- alloc_count, active_count, free_count);
-
- if (active_count + free_count != alloc_count)
- {
- ndbg("ERROR: Timer counts don't add up!");
- }
-}
-#endif
-
diff --git a/nuttx/netutils/thttpd/timers.h b/nuttx/netutils/thttpd/timers.h
index e2f3ab57a..2d28d3558 100644
--- a/nuttx/netutils/thttpd/timers.h
+++ b/nuttx/netutils/thttpd/timers.h
@@ -132,13 +132,5 @@ extern void tmr_cleanup(void);
extern void tmr_destroy(void);
-/* Generate debugging statistics syslog message. */
-
-#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
-extern void tmr_logstats(long secs);
-#else
-# define tmr_logstats(secs)
-#endif
-
#endif /* __NETUTILS_THTTPD_TIMERS_H */