[CalendarServer-changes] [9065] CalendarServer/branches/users/glyph/ipv6-client/twext/internet

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 13 11:44:40 PDT 2012


Revision: 9065
          http://trac.macosforge.org/projects/calendarserver/changeset/9065
Author:   glyph at apple.com
Date:     2012-04-13 11:44:40 -0700 (Fri, 13 Apr 2012)
Log Message:
-----------
reconnecting too soon raises a RuntimeError

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/ipv6-client/twext/internet/adaptendpoint.py
    CalendarServer/branches/users/glyph/ipv6-client/twext/internet/test/test_adaptendpoint.py

Modified: CalendarServer/branches/users/glyph/ipv6-client/twext/internet/adaptendpoint.py
===================================================================
--- CalendarServer/branches/users/glyph/ipv6-client/twext/internet/adaptendpoint.py	2012-04-13 18:44:35 UTC (rev 9064)
+++ CalendarServer/branches/users/glyph/ipv6-client/twext/internet/adaptendpoint.py	2012-04-13 18:44:40 UTC (rev 9065)
@@ -77,6 +77,8 @@
 
 
     def connect(self):
+        if self.wrapper._outstandingAttempt is not None:
+            raise RuntimeError("connection already in progress")
         self.wrapper.startAttempt()
 
 

Modified: CalendarServer/branches/users/glyph/ipv6-client/twext/internet/test/test_adaptendpoint.py
===================================================================
--- CalendarServer/branches/users/glyph/ipv6-client/twext/internet/test/test_adaptendpoint.py	2012-04-13 18:44:35 UTC (rev 9064)
+++ CalendarServer/branches/users/glyph/ipv6-client/twext/internet/test/test_adaptendpoint.py	2012-04-13 18:44:40 UTC (rev 9065)
@@ -220,6 +220,15 @@
         self.connectionSucceeds()
 
 
+    def test_reConnectTooSoon(self):
+        """
+        If the L{IConnector} is told to C{connect} while another attempt is
+        still in flight, it synchronously raises L{RuntimeError}.
+        """
+        self.assertRaises(RuntimeError, self.connector.connect)
+        self.assertEqual(len(self.factory.starts), 1)
+        self.assertEqual(len(self.endpoint.attempts), 1)
 
 
 
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120413/335ed2c3/attachment-0001.html>


More information about the calendarserver-changes mailing list