/
xbmc-pvr-84817e6-9997.01-PVR-PR390.patch
38 lines (32 loc) · 1.38 KB
/
xbmc-pvr-84817e6-9997.01-PVR-PR390.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 994a4cb70a9437105ef9c176d5d79939382d22e8 Mon Sep 17 00:00:00 2001
From: Gregor Fuis <gregor.fuis@gmail.com>
Date: Mon, 2 Jan 2012 17:13:54 +0100
Subject: [PATCH] tvheadend pvr client: retry connecting within timout
---
xbmc/pvrclients/tvheadend/HTSPConnection.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/xbmc/pvrclients/tvheadend/HTSPConnection.cpp b/xbmc/pvrclients/tvheadend/HTSPConnection.cpp
index 5f5865d..4adb45b 100644
--- a/xbmc/pvrclients/tvheadend/HTSPConnection.cpp
+++ b/xbmc/pvrclients/tvheadend/HTSPConnection.cpp
@@ -57,12 +57,20 @@ bool CHTSPConnection::Connect()
if (m_bIsConnected)
return true;
+ cTimeMs RetryTimeout;
char errbuf[1024];
int errlen = sizeof(errbuf);
XBMC->Log(LOG_DEBUG, "%s - connecting to '%s', port '%d'", __FUNCTION__, m_strHostname.c_str(), m_iPortnumber);
- m_fd = tcp_connect(m_strHostname.c_str(), m_iPortnumber, errbuf, errlen, m_iConnectTimeout);
+ m_fd = INVALID_SOCKET;
+ while (m_fd == INVALID_SOCKET && RetryTimeout.Elapsed() < (uint)m_iConnectTimeout * 1000)
+ {
+ m_fd = tcp_connect(m_strHostname.c_str(), m_iPortnumber, errbuf, errlen,
+ m_iConnectTimeout * 1000 - RetryTimeout.Elapsed());
+ cCondWait::SleepMs(100);
+ }
+
if(m_fd == INVALID_SOCKET)
{
XBMC->Log(LOG_ERROR, "%s - failed to connect to the backend (%s)", __FUNCTION__, errbuf);
--
1.7.5.4