Am 01.10.2012 03:46, schrieb ArtemGr:
> Denis Loh <denis.loh@...> writes:
>> Hi Tommi,
>>
>> I try to be more precise: I want to detect on server side if there are
>> any open or pending requests, so that I know when to shut down the
>> server. I am using your library to serve streaming contents and I want
>> to prevent the user from closing open connections when he want to stop
>> the server. So, I thought about displaying a message or something else
>> that there are active requests.
> If that's an administrative task,
> then perhaps you might do with external tools?
> Something along the lines of
> lsof -i -n -p `pidof tntnet` | grep TCP | grep ':http->'
> or
> ls -laF /proc/`pidof tntnet`/fd/ | grep socket
A open TCP connection do not mean, that there is a active http transfer. 
Think about keep-alive. If a request is processed, http keeps the 
connection open for a while. Both ends are allowed to disconnect if they 
wish to do so.

If you call tnt::Tntnet::shutdown, tntnet stops accepting new requests 
and waits until all requests are finished. There is no direct way to 
detect active requests.

What about my suggestion to implement it in a global class? Any request, 
you want to monitor may instantiate a class, which increments a global 
(atomic) counter in the ctor and decrements it in the destructor. Then 
you can always check the counter.

There is such a counter in tntnet internally but I don't think it makes 
too much sense to make it public, since it a very special feature and 
really easy to implement without support from tntnet.

Tommi

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to