Revision 41e2ed46 ncclient/transport/session.py

b/ncclient/transport/session.py
17 17
from ncclient.capabilities import Capabilities, CAPABILITIES
18 18
from ncclient.glue import Subject
19 19

  
20
from . import logger
21 20
from hello import HelloHandler
22 21

  
22
import logging
23
logger = logging.getLogger('ncclient.transport.session')
24

  
23 25
class Session(Subject):
24 26
    
25 27
    "TODO: docstring"
26 28
    
27 29
    def __init__(self):
28
        "TODO: docstring"
30
        "Subclass constructor should call this"
29 31
        Subject.__init__(self)
30 32
        self.setName('session')
31
        self.setDaemon(True) #hmm
32 33
        self._client_capabilities = CAPABILITIES
33 34
        self._server_capabilities = None # yet
34 35
        self._id = None # session-id
35 36
        self._connected = False # to be set/cleared by subclass implementation
36
        logger.debug('[session object created] client_capabilities=%r' %
37
                     self._client_capabilities)
37
        logger.debug('%r created: client_capabilities=%r' %
38
                     (self, self._client_capabilities))
38 39
    
39 40
    def _post_connect(self):
40
        "TODO: docstring"
41
        "Greeting stuff"
41 42
        init_event = Event()
42 43
        error = [None] # so that err_cb can bind error[0]. just how it is.
43 44
        # callbacks
......
51 52
        listener = HelloHandler(ok_cb, err_cb)
52 53
        self.add_listener(listener)
53 54
        self.send(HelloHandler.build(self._client_capabilities))
54
        logger.debug('[starting main loop]')
55
        logger.debug('starting main loop')
55 56
        self.start()
56 57
        # we expect server's hello message
57 58
        init_event.wait()
......
63 64
                     (self._id, self._server_capabilities))
64 65
    
65 66
    def connect(self, *args, **kwds):
66
        "TODO: docstring"
67
        "Subclass implements"
67 68
        raise NotImplementedError
68 69

  
69 70
    def run(self):
71
        "Subclass implements"
70 72
        raise NotImplementedError
71 73
    
72 74
    ### Properties

Also available in: Unified diff