Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler Class Reference
Inheritance diagram for test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler:
Inheritance graph
[legend]
Collaboration diagram for test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def readable
def handle_read
def handle_close
def handle_error
def initiate_send
def handle_write
def writable
def send
def __repr__
def add_channel
def del_channel
def create_socket
def set_socket

Public Attributes

 socket
 out_buffer
 family_and_type

Static Public Attributes

 debug = False
 connected = False
 accepting = False
 closing = False
 addr = None
tuple ignore_log_types = frozenset(['warning'])

Private Member Functions

def _do_ssl_handshake

Private Attributes

 _ssl_accepting

Detailed Description

Definition at line 892 of file test_ssl.py.


Constructor & Destructor Documentation

Reimplemented from asyncore.dispatcher_with_send.

Definition at line 894 of file test_ssl.py.

00894 
00895                 def __init__(self, conn, certfile):
00896                     self.socket = ssl.wrap_socket(conn, server_side=True,
00897                                                   certfile=certfile,
00898                                                   do_handshake_on_connect=False)
00899                     asyncore.dispatcher_with_send.__init__(self, self.socket)
00900                     self._ssl_accepting = True
00901                     self._do_ssl_handshake()

Here is the caller graph for this function:


Member Function Documentation

def asyncore.dispatcher.__repr__ (   self) [inherited]

Definition at line 264 of file asyncore.py.

00264 
00265     def __repr__(self):
00266         status = [self.__class__.__module__+"."+self.__class__.__name__]
00267         if self.accepting and self.addr:
00268             status.append('listening')
00269         elif self.connected:
00270             status.append('connected')
00271         if self.addr is not None:
00272             try:
00273                 status.append('%s:%d' % self.addr)
00274             except TypeError:
00275                 status.append(repr(self.addr))
00276         return '<%s at %#x>' % (' '.join(status), id(self))

Definition at line 908 of file test_ssl.py.

00908 
00909                 def _do_ssl_handshake(self):
00910                     try:
00911                         self.socket.do_handshake()
00912                     except ssl.SSLError as err:
00913                         if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
00914                                            ssl.SSL_ERROR_WANT_WRITE):
00915                             return
00916                         elif err.args[0] == ssl.SSL_ERROR_EOF:
00917                             return self.handle_close()
00918                         raise
00919                     except socket.error as err:
00920                         if err.args[0] == errno.ECONNABORTED:
00921                             return self.handle_close()
00922                     else:
00923                         self._ssl_accepting = False

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncore.dispatcher.add_channel (   self,
  map = None 
) [inherited]

Definition at line 279 of file asyncore.py.

00279 
00280     def add_channel(self, map=None):
00281         #self.log_info('adding channel %s' % self)
00282         if map is None:
00283             map = self._map
00284         map[self._fileno] = self

Here is the caller graph for this function:

def asyncore.dispatcher.create_socket (   self,
  family,
  type 
) [inherited]

Definition at line 294 of file asyncore.py.

00294 
00295     def create_socket(self, family, type):
00296         self.family_and_type = family, type
00297         sock = socket.socket(family, type)
00298         sock.setblocking(0)
00299         self.set_socket(sock)

Here is the caller graph for this function:

def asyncore.dispatcher.del_channel (   self,
  map = None 
) [inherited]

Definition at line 285 of file asyncore.py.

00285 
00286     def del_channel(self, map=None):
00287         fd = self._fileno
00288         if map is None:
00289             map = self._map
00290         if fd in map:
00291             #self.log_info('closing channel %d:%s' % (fd, self))
00292             del map[fd]
00293         self._fileno = None

Here is the caller graph for this function:

Definition at line 936 of file test_ssl.py.

00936 
00937                 def handle_close(self):
00938                     self.close()
00939                     if support.verbose:
00940                         sys.stdout.write(" server:  closed connection %s\n" % self.socket)

Here is the caller graph for this function:

Definition at line 941 of file test_ssl.py.

00941 
00942                 def handle_error(self):
00943                     raise
00944 
            def __init__(self, certfile):

Here is the caller graph for this function:

Definition at line 924 of file test_ssl.py.

00924 
00925                 def handle_read(self):
00926                     if self._ssl_accepting:
00927                         self._do_ssl_handshake()
00928                     else:
00929                         data = self.recv(1024)
00930                         if support.verbose:
00931                             sys.stdout.write(" server:  read %s from client\n" % repr(data))
00932                         if not data:
00933                             self.close()
00934                         else:
00935                             self.send(data.lower())

def asyncore.dispatcher_with_send.handle_write (   self) [inherited]

Definition at line 544 of file asyncore.py.

00544 
00545     def handle_write(self):
00546         self.initiate_send()

Here is the call graph for this function:

def asyncore.dispatcher_with_send.initiate_send (   self) [inherited]

Definition at line 539 of file asyncore.py.

00539 
00540     def initiate_send(self):
00541         num_sent = 0
00542         num_sent = dispatcher.send(self, self.out_buffer[:512])
00543         self.out_buffer = self.out_buffer[num_sent:]

Here is the caller graph for this function:

Definition at line 902 of file test_ssl.py.

00902 
00903                 def readable(self):
00904                     if isinstance(self.socket, ssl.SSLSocket):
00905                         while self.socket.pending() > 0:
00906                             self.handle_read_event()
00907                     return True

Here is the call graph for this function:

def asyncore.dispatcher_with_send.send (   self,
  data 
) [inherited]

Definition at line 550 of file asyncore.py.

00550 
00551     def send(self, data):
00552         if self.debug:
00553             self.log_info('sending %s' % repr(data))
00554         self.out_buffer = self.out_buffer + data
00555         self.initiate_send()
00556 
00557 # ---------------------------------------------------------------------------
00558 # used for debugging.
00559 # ---------------------------------------------------------------------------

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncore.dispatcher.set_socket (   self,
  sock,
  map = None 
) [inherited]

Definition at line 300 of file asyncore.py.

00300 
00301     def set_socket(self, sock, map=None):
        self.socket = sock

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncore.dispatcher_with_send.writable (   self) [inherited]

Definition at line 547 of file asyncore.py.

00547 
00548     def writable(self):
00549         return (not self.connected) or len(self.out_buffer)


Member Data Documentation

Definition at line 899 of file test_ssl.py.

asyncore.dispatcher.accepting = False [static, inherited]

Definition at line 227 of file asyncore.py.

asyncore.dispatcher.addr = None [static, inherited]

Reimplemented in smtpd.SMTPChannel.

Definition at line 229 of file asyncore.py.

asyncore.dispatcher.closing = False [static, inherited]

Definition at line 228 of file asyncore.py.

asyncore.dispatcher.connected = False [static, inherited]

Reimplemented in asyncore.file_dispatcher.

Definition at line 226 of file asyncore.py.

asyncore.dispatcher.debug = False [static, inherited]

Definition at line 225 of file asyncore.py.

Definition at line 295 of file asyncore.py.

tuple asyncore.dispatcher.ignore_log_types = frozenset(['warning']) [static, inherited]

Definition at line 230 of file asyncore.py.

Definition at line 537 of file asyncore.py.

Reimplemented from asyncore.dispatcher.

Definition at line 895 of file test_ssl.py.


The documentation for this class was generated from the following file: