示例#1
0
 def _send_loop(self):
     while True:
         command = force_bytes(self._send_queue.get())
         try:
             self._socket.sendall(command)
         except Exception:
             eventlet.spawn(self.reconnect)
             return
示例#2
0
文件: service.py 项目: 1stvamp/pubbot
 def _send_loop(self):
     while True:
         command = force_bytes(self._send_queue.get())
         self.logger.debug('send: %r', command[:-2])
         try:
             self._socket.sendall(command)
         except Exception:
             self.logger.exception("Client._send_loop failed")
             gevent.spawn(self.reconnect)
             return
示例#3
0
文件: tests.py 项目: 1stvamp/pubbot
 def test_force_bytes_b(self):
     self.assertTrue(isinstance(force_bytes(b"HELLO"), str))
示例#4
0
文件: tests.py 项目: pubbothq/pubbot
 def test_force_bytes_u(self):
     self.assertTrue(isinstance(force_bytes(u"HELLO"), bytes))