Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 72561 invoked from network); 12 Sep 2007 13:12:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Sep 2007 13:12:16 -0000 Received: (qmail 62221 invoked by uid 500); 12 Sep 2007 13:12:09 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 62208 invoked by uid 500); 12 Sep 2007 13:12:09 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 62199 invoked by uid 99); 12 Sep 2007 13:12:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 06:12:09 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2007 13:13:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 60A6A1A9832; Wed, 12 Sep 2007 06:11:53 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574936 - /incubator/qpid/trunk/qpid/python/qpid/connection.py Date: Wed, 12 Sep 2007 13:11:53 -0000 To: qpid-commits@incubator.apache.org From: astitcher@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070912131153.60A6A1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: astitcher Date: Wed Sep 12 06:11:52 2007 New Revision: 574936 URL: http://svn.apache.org/viewvc?rev=574936&view=rev Log: * Python: reinstated 0-8 framing in parallel with the new 0-10 framing Modified: incubator/qpid/trunk/qpid/python/qpid/connection.py Modified: incubator/qpid/trunk/qpid/python/qpid/connection.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/connection.py?rev=574936&r1=574935&r2=574936&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/qpid/connection.py (original) +++ incubator/qpid/trunk/qpid/python/qpid/connection.py Wed Sep 12 06:11:52 2007 @@ -77,7 +77,9 @@ self.codec = codec.Codec(io, spec) self.spec = spec self.FRAME_END = self.spec.constants.byname["frame_end"].id - + self.write = getattr(self, "write_%s_%s" % (self.spec.major, self.spec.minor)) + self.read = getattr(self, "read_%s_%s" % (self.spec.major, self.spec.minor)) + def flush(self): self.codec.flush() @@ -89,8 +91,36 @@ def tini(self): self.codec.unpack(Connection.INIT) + + def write_8_0(self, frame): + c = self.codec + c.encode_octet(self.spec.constants.byname[frame.type].id) + c.encode_short(frame.channel) + body = StringIO() + enc = codec.Codec(body, self.spec) + frame.encode(enc) + enc.flush() + c.encode_longstr(body.getvalue()) + c.encode_octet(self.FRAME_END) + + def read_8_0(self): + c = self.codec + type = self.spec.constants.byid[c.decode_octet()].name + channel = c.decode_short() + body = c.decode_longstr() + dec = codec.Codec(StringIO(body), self.spec) + frame = Frame.DECODERS[type].decode(self.spec, dec, len(body)) + frame.channel = channel + end = c.decode_octet() + if end != self.FRAME_END: + garbage = "" + while end != self.FRAME_END: + garbage += chr(end) + end = c.decode_octet() + raise "frame error: expected %r, got %r" % (self.FRAME_END, garbage) + return frame - def write(self, frame): + def write_0_10(self, frame): c = self.codec c.encode_octet(0x0f) # TODO: currently fixed at ver=0, B=E=b=e=1 c.encode_octet(self.spec.constants.byname[frame.type].id) @@ -107,7 +137,7 @@ c.write(body.getvalue()) c.encode_octet(self.FRAME_END) - def read(self): + def read_0_10(self): c = self.codec flags = c.decode_octet() # TODO: currently ignoring flags framing_version = (flags & 0xc0) >> 6