summaryrefslogtreecommitdiffstats
path: root/module/remote/thriftbackend/Transport.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2011-02-13 15:06:03 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2011-02-13 15:06:03 +0100
commit908c28bab89525250172a4013667319942846065 (patch)
tree73b85517ae12f8be4bc2071409136f181907795d /module/remote/thriftbackend/Transport.py
parentcleanup (diff)
downloadpyload-908c28bab89525250172a4013667319942846065.tar.xz
fixes + improvements
Diffstat (limited to 'module/remote/thriftbackend/Transport.py')
-rw-r--r--module/remote/thriftbackend/Transport.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/module/remote/thriftbackend/Transport.py b/module/remote/thriftbackend/Transport.py
new file mode 100644
index 000000000..50638f461
--- /dev/null
+++ b/module/remote/thriftbackend/Transport.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+from thrift.transport.TTransport import TBufferedTransport
+
+class Transport(TBufferedTransport):
+ DEFAULT_BUFFER = 4096
+
+ def __init__(self, trans, rbuf_size = DEFAULT_BUFFER):
+ TBufferedTransport.__init__(self, trans, rbuf_size)
+ self.remoteaddr = trans.handle.getpeername()
+
+class TransportFactory:
+ def getTransport(self, trans):
+ buffered = Transport(trans)
+ return buffered