Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | Static Private Attributes
asyncore.dispatcher Class Reference
Inheritance diagram for asyncore.dispatcher:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def add_channel
def del_channel
def create_socket
def set_socket

Public Attributes

 socket
 family_and_type

Static Public Attributes

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

Private Attributes

 _map
 _fileno

Static Private Attributes

 __str__ = __repr__

Detailed Description

Definition at line 223 of file asyncore.py.


Constructor & Destructor Documentation

def asyncore.dispatcher.__init__ (   self,
  sock = None,
  map = None 
)

Reimplemented in test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler, asyncore.file_dispatcher, test.test_smtplib.SimSMTPServer, asyncore.dispatcher_with_send, smtpd.SMTPServer, test.test_ftplib.DummyTLS_DTPHandler, test.test_ftplib.DummyFTPServer, test.test_poplib.DummyPOP3Server, asynchat.async_chat, test.test_asynchat.echo_client, test.test_ftplib.DummyDTPHandler, and test.test_smtpd.DummyServer.

Definition at line 232 of file asyncore.py.

00232 
00233     def __init__(self, sock=None, map=None):
00234         if map is None:
00235             self._map = socket_map
00236         else:
00237             self._map = map
00238 
00239         self._fileno = None
00240 
00241         if sock:
00242             # Set to nonblocking just to make sure for cases where we
00243             # get a socket from a blocking source.
00244             sock.setblocking(0)
00245             self.set_socket(sock, map)
00246             self.connected = True
00247             # The constructor no longer requires that the socket
00248             # passed be connected.
00249             try:
00250                 self.addr = sock.getpeername()
00251             except socket.error as err:
00252                 if err.args[0] == ENOTCONN:
00253                     # To handle the case where we got an unconnected
00254                     # socket.
00255                     self.connected = False
00256                 else:
00257                     # The socket is broken in some unknown way, alert
00258                     # the user and remove it from the map (to prevent
00259                     # polling of broken sockets).
00260                     self.del_channel(map)
00261                     raise
00262         else:
00263             self.socket = None

Here is the caller graph for this function:


Member Function Documentation

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))

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

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 
)

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 
)

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:

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

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:


Member Data Documentation

Definition at line 277 of file asyncore.py.

Reimplemented in asyncore.file_dispatcher.

Definition at line 238 of file asyncore.py.

Definition at line 234 of file asyncore.py.

Definition at line 227 of file asyncore.py.

asyncore.dispatcher.addr = None [static]

Reimplemented in smtpd.SMTPChannel.

Definition at line 229 of file asyncore.py.

asyncore.dispatcher.closing = False [static]

Definition at line 228 of file asyncore.py.

Reimplemented in asyncore.file_dispatcher.

Definition at line 226 of file asyncore.py.

asyncore.dispatcher.debug = False [static]

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]

Definition at line 230 of file asyncore.py.


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