Ejemplo n.º 1
0
 def __init__(self, addr):
     self.msgid = 1
     self.addr = addr
     if isinstance(addr, tuple):
         self.sock = coro.tcp_sock()
     else:
         self.sock = coro.unix_sock()
     self.sock.connect(addr)
     self.pending = {}
     self.recv_thread_ob = coro.spawn(self.recv_thread)
Ejemplo n.º 2
0
 def __init__(self, addr):
     self.msgid = 1
     self.addr = addr
     if isinstance(addr, tuple):
         self.sock = coro.tcp_sock()
     else:
         self.sock = coro.unix_sock()
     self.sock.connect(addr)
     self.pending = {}
     self.recv_thread_ob = coro.spawn(self.recv_thread)
Ejemplo n.º 3
0
    def connect_socket(self):
        """Connect to database at self.address.

        Returns socket object and function to send data on the socket.
        Works with TCP and Unix-domain sockets."""

        if isinstance(self.address, type('')):
            sock = coro.unix_sock()
        else:
            sock = coro.tcp_sock()
        sock.connect (self.address)
        return sock
Ejemplo n.º 4
0
 def make_socket (self):
     if isinstance(self.addr, str):
         return coro.unix_sock()
     else:
         return coro.tcp_sock()
Ejemplo n.º 5
0
 def make_socket(self):
     if isinstance(self.addr, str):
         return coro.unix_sock()
     else:
         return coro.tcp_sock()