Пример #1
0
 def send(self, data, flags=0, timeout=timeout_default):
     if timeout is timeout_default:
         timeout = self.timeout
     if self._sslobj:
         if flags != 0:
             raise ValueError(
                 "non-zero flags not allowed in calls to send() on %s" %
                 self.__class__)
         while True:
             try:
                 v = self._sslobj.write(data)
             except SSLError as x:
                 if x.args[0] == SSL_ERROR_WANT_READ:
                     if self.timeout == 0.0:
                         return 0
                     sys.exc_clear()
                     self._wait(self._read_event)
                 elif x.args[0] == SSL_ERROR_WANT_WRITE:
                     if self.timeout == 0.0:
                         return 0
                     sys.exc_clear()
                     self._wait(self._write_event)
                 else:
                     raise
             else:
                 return v
     else:
         return socket.send(self, data, flags, timeout)
Пример #2
0
 def send(self, data, flags=0, timeout=timeout_default):
     if timeout is timeout_default:
         timeout = self.timeout
     if self._sslobj:
         if flags != 0:
             raise ValueError(
                 "non-zero flags not allowed in calls to send() on %s" %
                 self.__class__)
         while True:
             try:
                 v = self._sslobj.write(data)
             except SSLError as x:
                 if x.args[0] == SSL_ERROR_WANT_READ:
                     if self.timeout == 0.0:
                         return 0
                     sys.exc_clear()
                     self._wait(self._read_event)
                 elif x.args[0] == SSL_ERROR_WANT_WRITE:
                     if self.timeout == 0.0:
                         return 0
                     sys.exc_clear()
                     self._wait(self._write_event)
                 else:
                     raise
             else:
                 return v
     else:
         return socket.send(self, data, flags, timeout)
    def send(self, data, flags=0, timeout=timeout_default):
        self._checkClosed()
        self.__check_flags('send', flags)

        if timeout is timeout_default:
            timeout = self.timeout

        if not self._sslobj:
            return socket.send(self, data, flags, timeout)

        while True:
            try:
                return self._sslobj.write(data)
            except SSLWantReadError:
                if self.timeout == 0.0:
                    return 0
                self._wait(self._read_event)
            except SSLWantWriteError:
                if self.timeout == 0.0:
                    return 0
                self._wait(self._write_event)
Пример #4
0
    def send(self, data, flags=0, timeout=timeout_default):
        self._checkClosed()
        self.__check_flags('send', flags)

        if timeout is timeout_default:
            timeout = self.timeout

        if not self._sslobj:
            return socket.send(self, data, flags, timeout)

        while True:
            try:
                return self._sslobj.write(data)
            except SSLWantReadError:
                if self.timeout == 0.0:
                    return 0
                self._wait(self._read_event)
            except SSLWantWriteError:
                if self.timeout == 0.0:
                    return 0
                self._wait(self._write_event)