summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch')
-rw-r--r--abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch b/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
new file mode 100644
index 0000000..4a2c4c3
--- /dev/null
+++ b/abs/core/mythtv/stable-30/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
@@ -0,0 +1,82 @@
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/ssdp.cpp mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/ssdp.cpp
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/ssdp.cpp 2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/ssdp.cpp 2019-01-05 12:44:56.990000000 +0100
+@@ -170,21 +170,21 @@
+ // ------------------------------------------------------------------
+
+ LOG(VB_UPNP, LOG_INFO,
+- "SSDP::EnableNotifications() - sending NTS_byebye");
+- m_pNotifyTask->SetNTS( NTS_byebye );
+- m_pNotifyTask->Execute( nullptr );
+-
+- m_bAnnouncementsEnabled = true;
++ "SSDP::EnableNotifications() - sending NTS_byebye2");
++ m_pNotifyTask->SetNTS( NTS_byebye2 );
++ }
++ else
++ {
++ LOG(VB_UPNP, LOG_INFO,
++ "SSDP::EnableNotifications() - sending NTS_alive");
++ m_pNotifyTask->SetNTS( NTS_alive );
+ }
+
++ m_bAnnouncementsEnabled = true;
++
+ // ------------------------------------------------------------------
+ // Add Announcement Task to the Queue
+ // ------------------------------------------------------------------
+-
+- LOG(VB_UPNP, LOG_INFO, "SSDP::EnableNotifications() - sending NTS_alive");
+-
+- m_pNotifyTask->SetNTS( NTS_alive );
+-
+ TaskQueue::Instance()->AddTask(m_pNotifyTask);
+
+ LOG(VB_UPNP, LOG_INFO,
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.cpp mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.cpp
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.cpp 2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.cpp 2019-01-05 12:44:56.990000000 +0100
+@@ -127,7 +127,9 @@
+
+ pSocket->writeBlock( scPacket, scPacket.length(),
+ pSocket->address(), pSocket->port() );
+- std::this_thread::sleep_for(std::chrono::milliseconds(random() % 250));
++ // Only wait if not sending final bybbye. This speeds up shutdown
++ if (m_eNTS != NTS_byebye)
++ std::this_thread::sleep_for(std::chrono::milliseconds(random() % 250));
+ pSocket->writeBlock( scPacket, scPacket.length(),
+ pSocket->address(), pSocket->port() );
+ }
+@@ -168,6 +170,11 @@
+
+ if (m_eNTS == NTS_alive)
+ pQueue->AddTask( (m_nMaxAge / 2) * 1000, (Task *)this );
++ else if (m_eNTS == NTS_byebye2)
++ {
++ m_eNTS = NTS_alive;
++ pQueue->AddTask( this );
++ }
+
+ m_mutex.unlock();
+
+diff -Naur mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.h mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.h
+--- mythtv-master-20190105-g3382e1a-old/mythtv/libs/libmythupnp/upnptasknotify.h 2019-01-05 12:44:55.383333333 +0100
++++ mythtv-master-20190105-g3382e1a-new/mythtv/libs/libmythupnp/upnptasknotify.h 2019-01-05 12:44:56.990000000 +0100
+@@ -38,7 +38,8 @@
+ typedef enum
+ {
+ NTS_alive = 0,
+- NTS_byebye = 1
++ NTS_byebye = 1,
++ NTS_byebye2
+
+ } UPnpNotifyNTS;
+
+@@ -90,6 +91,7 @@
+ {
+ case NTS_alive : return( "ssdp:alive" );
+ case NTS_byebye: return( "ssdp:byebye" );
++ case NTS_byebye2: return( "ssdp:byebye" );
+ }
+ return( "unknown" );
+ }