Re: [PATCH] Naive approach to HTTP-timeouts
"David Schmitz" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Slava,
that was the first thing I noticed this morning :(. So I suppose the
timeout-thread must be started in both "start_client_threads" and in
"start_server_thread".
Regards,
David
Vjacheslav Chekushin schrieb:
> Hi, David.
>
> You start timeout_control_thread in http_init(). It is wrong because
> this code:
>
> > +static void timeout_control_thread(void *arg) {
> > + while (run_status == running) {
> > + debug("",0, "timeout_control sleeping");
> > + gwthread_sleep(MIN_TIME_OUT);
> > + debug("",0, "timeout_control awake");
> > + check_timeout();
> > + }
> > + timeout_control_thread_id = -1;
>
> will be executed when run_status still is "limbo".
>
>
> David Schmitz wrote:
>
>> Hi Slava,
>>
>> no need to vote for my patch, because your approach is better.
>> IMO the discussion difftime vs. thread is needless, because we should
>> aim for scalability, and the thread-approach scales....
>> Thus I have merged my client stuff into your thread-stuff and voila,
>> see the attached patch. Let me know what you think :)
>>
>> Regards,
>> David
>>
>> Vjacheslav Chekushin schrieb:
>>
>>> Hi, David.
>>> Yes, I have thought about exactly the same:
>>> either difftime+last_check or thread-switch.
>>> I didn't compare the efficient of thease methods.
>>> I'v made thread because switch occur 1 time at minute (or any
>>> configured
>>> timeout) but difftime can occur many times in minute (unpredictable,
>>> depends
>>> on load).
>>> PS. I'm not running sms gateway part of kannel,
>>> so I have not load on http server,
>>> so I'm ready to vote for your difftime+last_check solution ;).
>>>
>>> David Schmitz wrote:
>>>
>>>> Hi Slava (and others),
>>>>
>>>> yeah, you have got a point there...
>>>> But this can be avoided by using something like:
>>>>
>>>> last_check = time(NULL);
>>>> while....
>>>> ....
>>>> now = time(NULL);
>>>> if ((ret == 0) || (difftime(now, last_check) >=
>>>> MIN_TIME_OUT)) {
>>>> check_timeout();
>>>> last_check = time(NULL);
>>>> }
>>>> ....
>>>>
>>>> It depends on whether you prefer a contex-switch (because of a
>>>> thread) to the calculation of a difftime.
>>>>
>
>
--
Mit freundlichen Gruessen/Best regards
David Schmitz
Softwareentwicklung
-----------------------------------------------------------------
Wapme Systems AG
Vogelsanger Weg 80
40470 Düsseldorf
Tel.: + 49 -211-7 48 45 - 2708
Fax: + 49 -211-80-6-06-2801
E-Mail: [email protected]
Internet: http://www.wapme-systems.de