Add GENA_NOTIFICATION_xxx_TIMEOUT variable.

Currently, in notify_send_and_recv function, pupnp waits for
HTTP_DEFAULT_TIMEOUT seconds when trying to send a GENA notification.
When there is a lot of notifications with CPs which was disconnected
without unsusbcribing, all the pupnp threads are blocked on this
timeout. To correct, this issue, this patch adds a new variable,
GENA_NOTIFICATION_SENDING_TIMEOUT, which can be used to lower the
timeout so GENA threads return quickly when writing is impossible. By
the same mean, pupnp waits the CP's answer to the NOTIFY for
HTTP_DEFAULT_TIMEOUT seconds, so this patch adds a new variable,
GENA_NOTIFICATION_ANSWERING_TIMEOUT, to customize this value.
This commit is contained in:
Fabrice Fontaine 2010-11-10 13:29:06 +01:00 committed by Marcelo Roberto Jimenez
parent 32cffb5bb5
commit e6c548f57a
3 changed files with 62 additions and 1 deletions

View File

@ -2,6 +2,21 @@
Version 1.6.10
*******************************************************************************
2010-11-10 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Add GENA_NOTIFICATION_xxx_TIMEOUT variable.
Currently, in notify_send_and_recv function, pupnp waits for
HTTP_DEFAULT_TIMEOUT seconds when trying to send a GENA notification.
When there is a lot of notifications with CPs which was disconnected
without unsusbcribing, all the pupnp threads are blocked on this
timeout. To correct, this issue, this patch adds a new variable,
GENA_NOTIFICATION_SENDING_TIMEOUT, which can be used to lower the
timeout so GENA threads return quickly when writing is impossible. By
the same mean, pupnp waits the CP's answer to the NOTIFY for
HTTP_DEFAULT_TIMEOUT seconds, so this patch adds a new variable,
GENA_NOTIFICATION_ANSWERING_TIMEOUT, to customize this value.
2010-11-10 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Add --disable-blocking-tcp-connections flag.

View File

@ -217,7 +217,7 @@ static UPNP_INLINE int notify_send_and_recv(
return UPNP_E_OUTOF_MEMORY;
}
timeout = HTTP_DEFAULT_TIMEOUT;
timeout = GENA_NOTIFICATION_SENDING_TIMEOUT;
/* send msg (note: end of notification will contain "\r\n" twice) */
ret_code = http_SendMessage(&info, &timeout,
@ -232,6 +232,8 @@ static UPNP_INLINE int notify_send_and_recv(
return ret_code;
}
timeout = GENA_NOTIFICATION_ANSWERING_TIMEOUT;
ret_code = http_RecvMessage(&info, response,
HTTPMETHOD_NOTIFY, &timeout, &err_code);
if (ret_code) {

View File

@ -294,6 +294,50 @@
/* @} */
/*!
* \name GENA_NOTIFICATION_SENDING_TIMEOUT
*
* The {\tt GENA_NOTIFICATION_SENDING_TIMEOUT} specifies the number of seconds
* to wait for sending GENA notifications to the Control Point.
*
* This timeout will be used to know how many seconds GENA notification threads
* will wait to write on the socket to send the notification. By putting a
* lower value than HTTP_DEFAULT_TIMEOUT, the thread will not wait too long and
* will return quickly if writing is impossible. This is very useful as some
* Control Points disconnect from the network without unsubscribing as a result
* if HTTP_DEFAULT_TIMEOUT is used, all the GENA threads will be blocked to send
* notifications to those disconnected Control Points until the subscription
* expires.
*
* @{
*/
#define GENA_NOTIFICATION_SENDING_TIMEOUT HTTP_DEFAULT_TIMEOUT
/* @} */
/*!
* \name GENA_NOTIFICATION_ANSWERING_TIMEOUT
*
* The {\tt GENA_NOTIFICATION_ANSWERING_TIMEOUT} specifies the number of seconds
* to wait for receiving the answer to a GENA notification from the Control
* Point.
*
* This timeout will be used to know how many seconds GENA notification threads
* will wait on the socket to read for an answer from the CP. By putting a
* lower value than HTTP_DEFAULT_TIMEOUT, the thread will not wait too long and
* will return quickly if there is no answer from the CP. This is very useful as
* some Control Points disconnect from the network without unsubscribing and if
* HTTP_DEFAULT_TIMEOUT is used, all the GENA threads will be blocked to wait
* for an answer from those disconnected Control Points until the subscription
* expires. However, it should be noted that UDA specifies a value of 30s for
* waiting the CP's answer.
*
* @{
*/
#define GENA_NOTIFICATION_ANSWERING_TIMEOUT HTTP_DEFAULT_TIMEOUT
/* @} */
/*!
* \name Module Exclusion
*