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)
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
def make_socket (self): if isinstance(self.addr, str): return coro.unix_sock() else: return coro.tcp_sock()
def make_socket(self): if isinstance(self.addr, str): return coro.unix_sock() else: return coro.tcp_sock()