(self)
| 336 | return result |
| 337 | |
| 338 | def readMessageBegin(self): |
| 339 | assert self.state == CLEAR |
| 340 | proto_id = self.__readUByte() |
| 341 | if proto_id != self.PROTOCOL_ID: |
| 342 | raise TProtocolException(TProtocolException.BAD_VERSION, |
| 343 | 'Bad protocol id in the message: %d' % proto_id) |
| 344 | ver_type = self.__readUByte() |
| 345 | type = (ver_type >> self.TYPE_SHIFT_AMOUNT) & self.TYPE_BITS |
| 346 | version = ver_type & self.VERSION_MASK |
| 347 | if version != self.VERSION: |
| 348 | raise TProtocolException(TProtocolException.BAD_VERSION, |
| 349 | 'Bad version: %d (expect %d)' % (version, self.VERSION)) |
| 350 | seqid = self.__readVarint() |
| 351 | # the sequence is a compact "var int" which is treaded as unsigned, |
| 352 | # however the sequence is actually signed... |
| 353 | if seqid > 2147483647: |
| 354 | seqid = -2147483648 - (2147483648 - seqid) |
| 355 | name = self.__readBinary().decode('utf-8') |
| 356 | return (name, type, seqid) |
| 357 | |
| 358 | def readMessageEnd(self): |
| 359 | assert self.state == CLEAR |
no test coverage detected