From 6518a1a430884bd9aac94e85fdf4037c75db1cd4 Mon Sep 17 00:00:00 2001 From: Xavier Queralt Date: Fri, 20 Jan 2012 10:23:32 +0100 Subject: [PATCH] Fix compatiblity with Twisted 11.1 --- flumotion/component/feed.py | 8 ++++++-- flumotion/twisted/fdserver.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flumotion/component/feed.py b/flumotion/component/feed.py index 54eebb9..65c4b3a 100644 --- a/flumotion/component/feed.py +++ b/flumotion/component/feed.py @@ -38,7 +38,7 @@ __version__ = "$Rev$" class _SocketMaybeCloser(tcp._SocketCloser): keepSocketAlive = False - def _closeSocket(self): + def _closeSocket(self, orderly=False): # We override this (from tcp._SocketCloser) so that we can close # sockets properly in the normal case, but once we've passed our # socket on via the FD-channel, we just close() it (not calling @@ -50,7 +50,11 @@ class _SocketMaybeCloser(tcp._SocketCloser): except socket.error: pass else: - tcp._SocketCloser._closeSocket(self) + args = {'self': self} + from twisted import version as v + if (v.major, v.minor, v.micro) > (11, 0, 0): + args['orderly'] = orderly + tcp.Server._closeSocket(**args) class PassableClientConnection(_SocketMaybeCloser, tcp.Client): diff --git a/flumotion/twisted/fdserver.py b/flumotion/twisted/fdserver.py index 1484a16..9c489d9 100644 --- a/flumotion/twisted/fdserver.py +++ b/flumotion/twisted/fdserver.py @@ -173,7 +173,7 @@ class FDPassingBroker(pb.Broker, log.Loggable): class _SocketMaybeCloser(tcp._SocketCloser): keepSocketAlive = False - def _closeSocket(self): + def _closeSocket(self, orderly=False): # We override this (from tcp._SocketCloser) so that we can close # sockets properly in the normal case, but once we've passed our # socket on via the FD-channel, we just close() it (not calling @@ -185,7 +185,11 @@ class _SocketMaybeCloser(tcp._SocketCloser): except socket.error: pass else: - tcp.Server._closeSocket(self) + args = {'self': self} + from twisted import version as v + if (v.major, v.minor, v.micro) > (11, 0, 0): + args['orderly'] = orderly + tcp.Server._closeSocket(**args) class PassableServerConnection(_SocketMaybeCloser, tcp.Server): -- 1.7.8.3