[CalendarServer-changes] [6521] CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 1 14:21:30 PDT 2010
Revision: 6521
http://trac.macosforge.org/projects/calendarserver/changeset/6521
Author: glyph at apple.com
Date: 2010-11-01 14:21:27 -0700 (Mon, 01 Nov 2010)
Log Message:
-----------
clean up getHost and getPeer, make it actually work
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py 2010-11-01 21:21:00 UTC (rev 6520)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/caldav.py 2010-11-01 21:21:27 UTC (rev 6521)
@@ -43,7 +43,6 @@
from twisted.internet.defer import gatherResults
from twisted.internet import reactor
from twisted.internet.reactor import addSystemEventTrigger
-from twisted.internet.tcp import Connection
from twisted.internet.process import ProcessExitedAlready
from twisted.internet.protocol import Protocol, Factory
from twisted.application.internet import TCPServer, UNIXServer
@@ -77,6 +76,7 @@
from txdav.base.datastore.asyncsqlpool import ConnectionPoolConnection
+from calendarserver.tap.util import ConnectionWithPeer
try:
from twistedcaldav.authkerb import NegotiateCredentialFactory
NegotiateCredentialFactory # pacify pyflakes
@@ -756,7 +756,9 @@
else:
postgresUID = None
postgresGID = None
- pgserv = pgServiceFromConfig(config, subServiceFactory, uid, gid)
+ pgserv = pgServiceFromConfig(
+ config, subServiceFactory, postgresUID, postgresGID
+ )
return pgserv
else:
return mainService
@@ -1054,9 +1056,11 @@
Dispense a file descriptor, already connected to a server, for a
client.
"""
+ # FIXME: these sockets need to be re-dispensed when the process is
+ # respawned, and they currently won't be.
c, s = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
protocol = ConnectionPoolConnection(self.pool)
- transport = Connection(s, protocol)
+ transport = ConnectionWithPeer(s, protocol)
protocol.makeConnection(transport)
return c
@@ -1122,6 +1126,7 @@
self.metaSocket = metaSocket
self.interfaces = interfaces
self.ampSQLDispenser = ampSQLDispenser
+ self.ampDBSocket = None
def getName(self):
@@ -1138,8 +1143,8 @@
if self.metaSocket is not None:
extraFDs.append(self.metaSocket.fileno())
if self.ampSQLDispenser is not None:
- skt = self.ampSQLDispenser()
- extraFDs.append(skt.fileno())
+ self.ampDBSocket = self.ampSQLDispenser.dispense()
+ extraFDs.append(self.ampDBSocket.fileno())
for fd in self.inheritSSLFDs + self.inheritFDs + extraFDs:
fds[fd] = fd
return fds
@@ -1193,7 +1198,6 @@
"-o", "InheritSSLFDs=%s" % (",".join(map(str, self.inheritSSLFDs)),)
])
-
if self.metaSocket is not None:
args.extend([
"-o", "MetaFD=%s" % (self.metaSocket.fileno(),)
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:21:00 UTC (rev 6520)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:21:27 UTC (rev 6521)
@@ -101,7 +101,13 @@
)
+class ConnectionWithPeer(Connection):
+ def getPeer(self):
+ return "<local>"
+ def getHost(self):
+ return "<local>"
+
def storeFromConfig(config, serviceParent, notifierFactory=None):
"""
Produce an L{IDataStore} from the given configuration and notifier factory.
@@ -118,8 +124,7 @@
skt = fromfd(AF_UNIX, SOCK_STREAM, config.DBAMPFD)
os.close(config.DBAMPFD)
protocol = ConnectionPoolClient()
- transport = Connection(skt, protocol) # XXX may need subclass for
- # getPeer and getHost
+ transport = ConnectionWithPeer(skt, protocol)
protocol.makeConnection(transport)
txnFactory = protocol.newTransaction
dataStore = CommonSQLDataStore(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101101/5b2fab46/attachment.html>
More information about the calendarserver-changes
mailing list