예제 #1
0
파일: net.py 프로젝트: cool-RR/Miro
 def close_connection(self):
     if self.isOpen():
         eventloop.stop_handling_socket(self.socket)
         self.stopReadTimeout()
         self.socket.close()
         self.socket = None
     if self.connectionErrback is not None:
         error = NetworkError(_("Connection closed"))
         trap_call(self, self.connectionErrback, error)
         self.connectionErrback = None
예제 #2
0
파일: net.py 프로젝트: kfatehi/miro
 def close_connection(self):
     if self.isOpen():
         eventloop.stop_handling_socket(self.socket)
         self.stopReadTimeout()
         self.socket.close()
         self.socket = None
     if self.connectionErrback is not None:
         error = NetworkError(_("Connection closed"))
         trap_call(self, self.connectionErrback, error)
         self.connectionErrback = None
예제 #3
0
파일: net.py 프로젝트: cool-RR/Miro
 def handleSocketError(self, code, msg, operation):
     if code in (socket.SSL_ERROR_WANT_READ, socket.SSL_ERROR_WANT_WRITE):
         if self.interruptedOperation is None:
             self.interruptedOperation = operation
         elif self.interruptedOperation != operation:
             signals.system.failed("When talking to the network", 
             details="socket error for the wrong SSL operation")
             self.close_connection()
             return
         eventloop.stop_handling_socket(self.socket)
         if code == socket.SSL_ERROR_WANT_READ:
             eventloop.add_read_callback(self.socket, self.onReadReady)
         else:
             eventloop.add_write_callback(self.socket, self.onWriteReady)
     elif code in (socket.SSL_ERROR_ZERO_RETURN, socket.SSL_ERROR_SSL,
             socket.SSL_ERROR_SYSCALL, socket.SSL_ERROR_EOF):
         self.handleEarlyClose(operation)
     else:
         super(AsyncSSLStream, self).handleSocketError(code, msg,
                 operation)
예제 #4
0
파일: net.py 프로젝트: kfatehi/miro
 def handleSocketError(self, code, msg, operation):
     if code in (socket.SSL_ERROR_WANT_READ, socket.SSL_ERROR_WANT_WRITE):
         if self.interruptedOperation is None:
             self.interruptedOperation = operation
         elif self.interruptedOperation != operation:
             signals.system.failed("When talking to the network", 
             details="socket error for the wrong SSL operation")
             self.close_connection()
             return
         eventloop.stop_handling_socket(self.socket)
         if code == socket.SSL_ERROR_WANT_READ:
             eventloop.add_read_callback(self.socket, self.onReadReady)
         else:
             eventloop.add_write_callback(self.socket, self.onWriteReady)
     elif code in (socket.SSL_ERROR_ZERO_RETURN, socket.SSL_ERROR_SSL,
             socket.SSL_ERROR_SYSCALL, socket.SSL_ERROR_EOF):
         self.handleEarlyClose(operation)
     else:
         super(AsyncSSLStream, self).handleSocketError(code, msg,
                 operation)