Commit ae232b82 authored by Dan Pascu's avatar Dan Pascu

Limit the time window for processing a DNS lookup to the current session

parent 51b45c0a
...@@ -303,6 +303,7 @@ class BlinkSession(QObject): ...@@ -303,6 +303,7 @@ class BlinkSession(QObject):
self.direction = None self.direction = None
self.__dict__['active'] = False self.__dict__['active'] = False
self.lookup = None
self.conference = None self.conference = None
self.sip_session = None self.sip_session = None
self.stream_descriptions = None self.stream_descriptions = None
...@@ -505,9 +506,9 @@ class BlinkSession(QObject): ...@@ -505,9 +506,9 @@ class BlinkSession(QObject):
uri = self.uri uri = self.uri
else: else:
uri = self.uri uri = self.uri
lookup = DNSLookup() self.lookup = DNSLookup()
notification_center.add_observer(self, sender=lookup) notification_center.add_observer(self, sender=self.lookup)
lookup.lookup_sip_proxy(uri, settings.sip.transport_list) self.lookup.lookup_sip_proxy(uri, settings.sip.transport_list)
def add_stream(self, stream_description): def add_stream(self, stream_description):
assert self.state == 'connected' assert self.state == 'connected'
...@@ -625,6 +626,7 @@ class BlinkSession(QObject): ...@@ -625,6 +626,7 @@ class BlinkSession(QObject):
self.timer.stop() self.timer.stop()
self.streams.clear() self.streams.clear()
self.lookup = None
self.sip_session = None self.sip_session = None
self.stream_descriptions = None self.stream_descriptions = None
self._sibling = None self._sibling = None
...@@ -684,7 +686,7 @@ class BlinkSession(QObject): ...@@ -684,7 +686,7 @@ class BlinkSession(QObject):
def _NH_DNSLookupDidSucceed(self, notification): def _NH_DNSLookupDidSucceed(self, notification):
notification.center.remove_observer(self, sender=notification.sender) notification.center.remove_observer(self, sender=notification.sender)
if self.state not in ('ending', 'ended', 'deleted'): if notification.sender is self.lookup:
routes = notification.data.result routes = notification.data.result
if routes: if routes:
self.sip_session = Session(self.account) self.sip_session = Session(self.account)
...@@ -694,7 +696,7 @@ class BlinkSession(QObject): ...@@ -694,7 +696,7 @@ class BlinkSession(QObject):
def _NH_DNSLookupDidFail(self, notification): def _NH_DNSLookupDidFail(self, notification):
notification.center.remove_observer(self, sender=notification.sender) notification.center.remove_observer(self, sender=notification.sender)
if self.state not in ('ending', 'ended', 'deleted'): if notification.sender is self.lookup:
self._terminate(reason='Destination not found', error=True) self._terminate(reason='Destination not found', error=True)
def _NH_SIPSessionNewOutgoing(self, notification): def _NH_SIPSessionNewOutgoing(self, notification):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment