lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Closing idle connections, recovering memory


From: Mike Kleshov
Subject: [lwip-users] Closing idle connections, recovering memory
Date: Thu, 22 Apr 2010 13:46:29 +0400

Hi All,

I am implementing an embedded http server using the raw API. I have 2
questions I'm not sure how to answer yet.

1) When my server receives a request from the browser, it chains
incoming pbuf's for processing. Those pbuf's are deallocated as soon
as they are parsed. It may happen that for some reason the connection
is aborted. How do I deallocate the pbuf's in that case? The callback
set with tcp_err() doesn't identify the connection being aborted. It
appears that the only way to do it is to periodically scan all my
active http connections and clean up as necessary. Am I right?

2) I want to prevent TCP connections from staying idle too long (say,
1 minute). If I understand correctly, TCP tolerates much longer
periods of inactivity (no packets in or out). How do I detect idle
connections? The raw API provides the poll callback. But how do I know
if there has been any activity? Would it be sensible to close the
connection if neither recved() not sent() callback has been called in
the last 1 minute?

Thanks in advance,
- mike




reply via email to

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