示例#1
0
 def _pre_open(self, sock=None):
     if sock is None:
         sock = socket.socket(self._domain, self._type)
     context = OpenSSL.Context(OpenSSL.SSLv23_METHOD)
     ssl_sock = OpenSSL.Connection(context, sock)
     ssl_sock.set_connect_state()
     GIOChannelClient._pre_open(self, ssl_sock)
示例#2
0
文件: sock.py 项目: AmiZya/emesene
 def _pre_open(self, sock=None):
     if sock is None:
         sock = socket.socket(self._domain, self._type)
         try:
             sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
         except AttributeError:
             pass
     GIOChannelClient._pre_open(self, sock)
示例#3
0
 def _pre_open(self, sock=None):
     if sock is None:
         sock = socket.socket(self._domain, self._type)
         try:
             sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
         except AttributeError:
             pass
     GIOChannelClient._pre_open(self, sock)
示例#4
0
 def _post_open(self):
     GIOChannelClient._post_open(self)
     if self._transport.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) == 0:
         self._watch_set_cond(gobject.IO_IN | gobject.IO_PRI | gobject.IO_OUT |
                            gobject.IO_ERR | gobject.IO_HUP)
     else:
         self.emit("error", IoError.CONNECTION_FAILED)
         self._status = IoStatus.CLOSED
     return False
示例#5
0
 def _pre_open(self, sock=None):
     if sock is None:
         sock = socket.socket(self._domain, self._type)
         try:
             sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
         except AttributeError:
             pass
     context = OpenSSL.Context(OpenSSL.SSLv23_METHOD)
     ssl_sock = OpenSSL.Connection(context, sock)
     GIOChannelClient._pre_open(self, ssl_sock)
示例#6
0
 def _post_open(self):
     GIOChannelClient._post_open(self)
     opts = self._transport.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
     if opts == 0:
         self._watch_set_cond(gobject.IO_IN | gobject.IO_PRI
                              | gobject.IO_ERR | gobject.IO_HUP)
         self._status = IoStatus.OPEN
     else:
         self.emit("error", IoConnectionFailed(self, str(opts)))
         self._status = IoStatus.CLOSED
     return False
示例#7
0
 def _post_open(self):
     GIOChannelClient._post_open(self)
     opts = self._transport.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
     if opts == 0:
         self._watch_set_cond(gobject.IO_IN | gobject.IO_PRI |
                            gobject.IO_ERR | gobject.IO_HUP)
         self._status = IoStatus.OPEN
     else:
         self.emit("error", IoConnectionFailed(self, str(opts)))
         self._status = IoStatus.CLOSED
     return False
示例#8
0
 def __init__(self, host, port, domain=AF_INET, type=SOCK_STREAM):
     GIOChannelClient.__init__(self, host, port, domain, type)
示例#9
0
 def _pre_open(self, sock=None):
     if sock is None:
         sock = socket.socket(self._domain, self._type)
     GIOChannelClient._pre_open(self, sock)