| 133 | logger.exception(x) |
| 134 | |
| 135 | def handle(self, client): |
| 136 | itrans = self.inputTransportFactory.getTransport(client) |
| 137 | iprot = self.inputProtocolFactory.getProtocol(itrans) |
| 138 | |
| 139 | # for THeaderProtocol, we must use the same protocol instance for input |
| 140 | # and output so that the response is in the same dialect that the |
| 141 | # server detected the request was in. |
| 142 | if isinstance(self.inputProtocolFactory, THeaderProtocolFactory): |
| 143 | otrans = None |
| 144 | oprot = iprot |
| 145 | else: |
| 146 | otrans = self.outputTransportFactory.getTransport(client) |
| 147 | oprot = self.outputProtocolFactory.getProtocol(otrans) |
| 148 | |
| 149 | try: |
| 150 | while True: |
| 151 | self.processor.process(iprot, oprot) |
| 152 | except TTransport.TTransportException: |
| 153 | pass |
| 154 | except Exception as x: |
| 155 | logger.exception(x) |
| 156 | |
| 157 | itrans.close() |
| 158 | if otrans: |
| 159 | otrans.close() |
| 160 | |
| 161 | |
| 162 | class TThreadPoolServer(TServer): |