[CalendarServer-changes] [6614] CalendarServer/branches/users/glyph/dont-start-postgres
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 10 21:58:29 PST 2010
Revision: 6614
http://trac.macosforge.org/projects/calendarserver/changeset/6614
Author: glyph at apple.com
Date: 2010-11-10 21:58:24 -0800 (Wed, 10 Nov 2010)
Log Message:
-----------
Unmerged revisions from failed dpush.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/__init__.py
CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py
CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/test/test_caldav.py
CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/sendfdport.py
CalendarServer/branches/users/glyph/dont-start-postgres/twext/python/sendmsg.c
Added Paths:
-----------
CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/
CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/__init__.py
CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/test_sendfdport.py
Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/__init__.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/__init__.py 2010-11-11 02:57:18 UTC (rev 6613)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/__init__.py 2010-11-11 05:58:24 UTC (rev 6614)
@@ -17,3 +17,13 @@
"""
CalendarServer TAP plugin support.
"""
+
+from calendarserver.tap import profiling # Pre-imported for side-effect
+
+__all__ = [
+ "caldav",
+ "carddav",
+ "profiling",
+ "util"
+]
+
Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py 2010-11-11 02:57:18 UTC (rev 6613)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py 2010-11-11 05:58:24 UTC (rev 6614)
@@ -70,8 +70,6 @@
from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
from twistedcaldav.upgrade import upgradeData
-import calendarserver.tap.profiling # Imported for side-effect
-
from calendarserver.tap.util import pgServiceFromConfig
from txdav.base.datastore.asyncsqlpool import ConnectionPool
@@ -957,6 +955,7 @@
monitor = DelayedStartupProcessMonitor()
s.processMonitor = monitor
+ monitor.setServiceParent(s)
for name, pool in config.Memcached.Pools.items():
if pool.ServerEnabled:
Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/test/test_caldav.py 2010-11-11 02:57:18 UTC (rev 6613)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/test/test_caldav.py 2010-11-11 05:58:24 UTC (rev 6614)
@@ -479,8 +479,26 @@
self.assertEquals(socketService.gid, alternateGroup)
+ def test_processMonitor(self):
+ """
+ In the master, there should be exactly one
+ L{DelayedStartupProcessMonitor} in the service hierarchy so that it
+ will be started by startup.
+ """
+ self.config["ProcessType"] = "Combined"
+ self.writeConfig()
+ self.assertEquals(
+ 1,
+ len(
+ list(inServiceHierarchy(
+ self.makeService(),
+ lambda x: isinstance(x, DelayedStartupProcessMonitor)))
+ )
+ )
+
+
class SlaveServiceTest(BaseServiceMakerTests):
"""
Test various configurations of the Slave service
Modified: CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/sendfdport.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/sendfdport.py 2010-11-11 02:57:18 UTC (rev 6613)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/sendfdport.py 2010-11-11 05:58:24 UTC (rev 6614)
@@ -1,6 +1,6 @@
# -*- test-case-name: twext.internet.test.test_sendfdport -*-
##
-# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+# Copyright (c) 2010 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -162,6 +162,7 @@
self.statusWatcher = statusWatcher
from twisted.internet import reactor
self.reactor = reactor
+ self._isDispatching = False
@property
@@ -202,6 +203,7 @@
"""
Start listening on all subprocess sockets.
"""
+ self._isDispatching = True
for subSocket in self._subprocessSockets:
subSocket.startReading()
@@ -218,6 +220,8 @@
i, o = socketpair(AF_UNIX, SOCK_DGRAM)
a = _SubprocessSocket(self, o)
self._subprocessSockets.append(a)
+ if self._isDispatching:
+ a.startReading()
return i
Added: CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/__init__.py
===================================================================
Added: CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/test_sendfdport.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/test_sendfdport.py (rev 0)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/twext/internet/test/test_sendfdport.py 2010-11-11 05:58:24 UTC (rev 6614)
@@ -0,0 +1,57 @@
+# -*- test-case-name: twext.internet.test.test_sendfdport -*-
+##
+# Copyright (c) 2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Tests for L{twext.internet.sendfdport}.
+"""
+
+from twisted.trial.unittest import TestCase
+from twext.internet.sendfdport import InheritedSocketDispatcher
+from twisted.internet.interfaces import IReactorFDSet
+from zope.interface.declarations import implements
+
+
+class ReaderAdder(object):
+ implements(IReactorFDSet)
+
+ def __init__(self):
+ self.readers = []
+
+ def addReader(self, reader):
+ self.readers.append(reader)
+
+ def getReaders(self):
+ return self.readers[:]
+
+
+
+class InheritedSocketDispatcherTests(TestCase):
+ """
+ Inherited socket dispatcher tests.
+ """
+
+ def test_addAfterStart(self):
+ """
+ Adding a socket to an L{InheritedSocketDispatcher} after it has already
+ been started results in it immediately starting reading.
+ """
+ reactor = ReaderAdder()
+ dispatcher = InheritedSocketDispatcher(None)
+ dispatcher.reactor = reactor
+ dispatcher.startDispatching()
+ dispatcher.addSocket()
+ self.assertEquals(reactor.getReaders(), dispatcher._subprocessSockets)
Modified: CalendarServer/branches/users/glyph/dont-start-postgres/twext/python/sendmsg.c
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/twext/python/sendmsg.c 2010-11-11 02:57:18 UTC (rev 6613)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/twext/python/sendmsg.c 2010-11-11 05:58:24 UTC (rev 6614)
@@ -158,11 +158,16 @@
Py_DECREF(iterator);
iterator = NULL;
- /* Allocate the buffer for all of the ancillary elements. */
- message_header.msg_control = malloc(all_data_len);
- if (!message_header.msg_control) {
- PyErr_NoMemory();
- return NULL;
+ /* Allocate the buffer for all of the ancillary elements, if we have
+ * any. */
+ if (all_data_len) {
+ message_header.msg_control = malloc(all_data_len);
+ if (!message_header.msg_control) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ } else {
+ message_header.msg_control = NULL;
}
message_header.msg_controllen = all_data_len;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101110/45b161a5/attachment-0001.html>
More information about the calendarserver-changes
mailing list