Back to index

python3.2  3.2.2
Classes | Public Member Functions | Public Attributes | Static Public Attributes
test.test_ssl.ThreadedEchoServer Class Reference
Inheritance diagram for test.test_ssl.ThreadedEchoServer:
Inheritance graph
[legend]
Collaboration diagram for test.test_ssl.ThreadedEchoServer:
Collaboration graph
[legend]

List of all members.

Classes

class  ConnectionHandler

Public Member Functions

def __init__
def start
def run
def stop
def daemon
def daemon
def name
def name
def __repr__
def start
def join
def ident
def is_alive
def isDaemon
def setDaemon
def getName
def setName

Public Attributes

 context
 chatty
 connectionchatty
 starttls_server
 sock
 port
 flag
 active
 daemon
 name
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

 isAlive = is_alive

Detailed Description

Definition at line 717 of file test_ssl.py.


Constructor & Destructor Documentation

def test.test_ssl.ThreadedEchoServer.__init__ (   self,
  certificate = None,
  ssl_version = None,
  certreqs = None,
  cacerts = None,
  chatty = True,
  connectionchatty = False,
  starttls_server = False,
  ciphers = None,
  context = None 
)

Definition at line 833 of file test_ssl.py.

00833 
00834                      ciphers=None, context=None):
00835             if context:
00836                 self.context = context
00837             else:
00838                 self.context = ssl.SSLContext(ssl_version
00839                                               if ssl_version is not None
00840                                               else ssl.PROTOCOL_TLSv1)
00841                 self.context.verify_mode = (certreqs if certreqs is not None
00842                                             else ssl.CERT_NONE)
00843                 if cacerts:
00844                     self.context.load_verify_locations(cacerts)
00845                 if certificate:
00846                     self.context.load_cert_chain(certificate)
00847                 if ciphers:
00848                     self.context.set_ciphers(ciphers)
00849             self.chatty = chatty
00850             self.connectionchatty = connectionchatty
00851             self.starttls_server = starttls_server
00852             self.sock = socket.socket()
00853             self.port = support.bind_port(self.sock)
00854             self.flag = None
00855             self.active = False
00856             threading.Thread.__init__(self)
00857             self.daemon = True

Here is the caller graph for this function:


Member Function Documentation

def threading.Thread.__repr__ (   self) [inherited]

Definition at line 659 of file threading.py.

00659 
00660     def __repr__(self):
00661         assert self._initialized, "Thread.__init__() was not called"
00662         status = "initial"
00663         if self._started.is_set():
00664             status = "started"
00665         if self._stopped:
00666             status = "stopped"
00667         if self._daemonic:
00668             status += " daemon"
00669         if self._ident is not None:
00670             status += " %s" % self._ident
00671         return "<%s(%s, %s)>" % (self.__class__.__name__, self._name, status)

def threading.Thread.daemon (   self) [inherited]

Definition at line 894 of file threading.py.

00894 
00895     def daemon(self):
00896         assert self._initialized, "Thread.__init__() not called"
00897         return self._daemonic

def threading.Thread.daemon (   self,
  daemonic 
) [inherited]

Definition at line 899 of file threading.py.

00899 
00900     def daemon(self, daemonic):
00901         if not self._initialized:
00902             raise RuntimeError("Thread.__init__() not called")
00903         if self._started.is_set():
00904             raise RuntimeError("cannot set daemon status of active thread");
00905         self._daemonic = daemonic

def threading.Thread.getName (   self) [inherited]

Definition at line 912 of file threading.py.

00912 
00913     def getName(self):
00914         return self.name

def threading.Thread.ident (   self) [inherited]

Definition at line 883 of file threading.py.

00883 
00884     def ident(self):
00885         assert self._initialized, "Thread.__init__() not called"
00886         return self._ident

def threading.Thread.is_alive (   self) [inherited]

Definition at line 887 of file threading.py.

00887 
00888     def is_alive(self):
00889         assert self._initialized, "Thread.__init__() not called"
00890         return self._started.is_set() and not self._stopped

Here is the caller graph for this function:

def threading.Thread.isDaemon (   self) [inherited]

Definition at line 906 of file threading.py.

00906 
00907     def isDaemon(self):
00908         return self.daemon

def threading.Thread.join (   self,
  timeout = None 
) [inherited]

Reimplemented in threading._DummyThread.

Definition at line 838 of file threading.py.

00838 
00839     def join(self, timeout=None):
00840         if not self._initialized:
00841             raise RuntimeError("Thread.__init__() not called")
00842         if not self._started.is_set():
00843             raise RuntimeError("cannot join thread before it is started")
00844         if self is current_thread():
00845             raise RuntimeError("cannot join current thread")
00846 
00847         if __debug__:
00848             if not self._stopped:
00849                 self._note("%s.join(): waiting until thread stops", self)
00850 
00851         self._block.acquire()
00852         try:
00853             if timeout is None:
00854                 while not self._stopped:
00855                     self._block.wait()
00856                 if __debug__:
00857                     self._note("%s.join(): thread stopped", self)
00858             else:
00859                 deadline = _time() + timeout
00860                 while not self._stopped:
00861                     delay = deadline - _time()
00862                     if delay <= 0:
00863                         if __debug__:
00864                             self._note("%s.join(): timed out", self)
00865                         break
00866                     self._block.wait(delay)
00867                 else:
00868                     if __debug__:
00869                         self._note("%s.join(): thread stopped", self)
00870         finally:
00871             self._block.release()

Here is the call graph for this function:

Here is the caller graph for this function:

def threading.Thread.name (   self) [inherited]

Definition at line 873 of file threading.py.

00873 
00874     def name(self):
00875         assert self._initialized, "Thread.__init__() not called"
00876         return self._name

Here is the caller graph for this function:

def threading.Thread.name (   self,
  name 
) [inherited]

Definition at line 878 of file threading.py.

00878 
00879     def name(self, name):
00880         assert self._initialized, "Thread.__init__() not called"
00881         self._name = str(name)

Here is the caller graph for this function:

Reimplemented from threading.Thread.

Definition at line 862 of file test_ssl.py.

00862 
00863         def run(self):
00864             self.sock.settimeout(0.05)
00865             self.sock.listen(5)
00866             self.active = True
00867             if self.flag:
00868                 # signal an event
00869                 self.flag.set()
00870             while self.active:
00871                 try:
00872                     newconn, connaddr = self.sock.accept()
00873                     if support.verbose and self.chatty:
00874                         sys.stdout.write(' server:  new connection from '
00875                                          + repr(connaddr) + '\n')
00876                     handler = self.ConnectionHandler(self, newconn, connaddr)
00877                     handler.start()
00878                 except socket.timeout:
00879                     pass
00880                 except KeyboardInterrupt:
00881                     self.stop()
00882             self.sock.close()

Here is the call graph for this function:

Here is the caller graph for this function:

def threading.Thread.setDaemon (   self,
  daemonic 
) [inherited]

Definition at line 909 of file threading.py.

00909 
00910     def setDaemon(self, daemonic):
00911         self.daemon = daemonic

def threading.Thread.setName (   self,
  name 
) [inherited]

Definition at line 915 of file threading.py.

00915 
00916     def setName(self, name):
00917         self.name = name
00918 
00919 # The timer class was contributed by Itamar Shtull-Trauring

def threading.Thread.start (   self) [inherited]

Reimplemented in test.test_ftplib.DummyFTPServer, test.test_poplib.DummyPOP3Server, and multiprocessing.dummy.DummyProcess.

Definition at line 672 of file threading.py.

00672 
00673     def start(self):
00674         if not self._initialized:
00675             raise RuntimeError("thread.__init__() not called")
00676 
00677         if self._started.is_set():
00678             raise RuntimeError("threads can only be started once")
00679         if __debug__:
00680             self._note("%s.start(): starting thread", self)
00681         with _active_limbo_lock:
00682             _limbo[self] = self
00683         try:
00684             _start_new_thread(self._bootstrap, ())
00685         except Exception:
00686             with _active_limbo_lock:
00687                 del _limbo[self]
00688             raise
00689         self._started.wait()

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_ssl.ThreadedEchoServer.start (   self,
  flag = None 
)

Definition at line 858 of file test_ssl.py.

00858 
00859         def start(self, flag=None):
00860             self.flag = flag
00861             threading.Thread.start(self)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 883 of file test_ssl.py.

00883 
00884         def stop(self):
00885             self.active = False
00886 
    class AsyncoreEchoServer(threading.Thread):

Here is the caller graph for this function:


Member Data Documentation

Definition at line 854 of file test_ssl.py.

Definition at line 848 of file test_ssl.py.

Definition at line 849 of file test_ssl.py.

Definition at line 835 of file test_ssl.py.

Reimplemented from threading.Thread.

Definition at line 856 of file test_ssl.py.

Definition at line 853 of file test_ssl.py.

threading.Thread.isAlive = is_alive [static, inherited]

Definition at line 891 of file threading.py.

threading.Thread.name [inherited]

Definition at line 916 of file threading.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 852 of file test_ssl.py.

Definition at line 851 of file test_ssl.py.

Definition at line 850 of file test_ssl.py.


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