Description: Force an update of the last_time_updated service field so that some clients will refresh
Forwarded: http://coherence.beebits.net/ticket/320
Author: Martin Bartlett
Reviewed-By: Daniel T Chen <crimsun@ubuntu.com>
Origin: Martin Bartlett, https://bugs.launchpad.net/ubuntu/+source/coherence/+bug/621722/+attachment/1515639/+files/service.py.patch
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/coherence/+bug/621722
Last-Update: 2011-07-28

--- coherence/service.py	2010-08-24 16:23:50.000000000 +0200
+++ ./coherence/upnp/core/service.py	2010-08-24 16:21:23.000000000 +0200
@@ -368,6 +368,12 @@
             self.detection_completed = True
             louie.send('Coherence.UPnP.Service.detection_completed', sender=self.device, device=self.device)
             self.info("send signal Coherence.UPnP.Service.detection_completed for %r" % self)
+            if self.last_time_updated == None:
+                # The clients (e.g. media_server_client) check for last time to detect whether service detection is complete
+                # so we need to set it here and now to avoid a potential race condition
+                self.last_time_updated = time.time()
+                louie.send('Coherence.UPnP.DeviceClient.Service.notified', sender=self.device, service=self)
+                self.info("send signal Coherence.UPnP.DeviceClient.Service.notified for %r" % self)
             """
             if (self.last_time_updated == None):
                 if( self.id.endswith('AVTransport') or
