Change in vdsm[master]: vdsm: adding docstring to MultiProtocolAcceptor and Connecte...

nsoffer at redhat.com nsoffer at redhat.com
Thu Jun 26 06:57:35 UTC 2014


Nir Soffer has posted comments on this change.

Change subject: vdsm: adding docstring to MultiProtocolAcceptor and ConnectedTcpServer
......................................................................


Patch Set 7: Code-Review-1

(1 comment)

Suggested more useful docstring.

http://gerrit.ovirt.org/#/c/28806/7/vdsm/protocoldetector.py
File vdsm/protocoldetector.py:

Line 40:     Protocol detection is done by detectors which are provided by
Line 41:     calling add_detector. There are currently two protocol detectors.
Line 42:     One for already existing xmlrpc and the other for new jsonrpc over
Line 43:     stomp.
Line 44:     """
This is not very useful documentation. How about:

    Provides multiple protocol support on a single port.

    MultiProtocolAcceptor binds and listen to single port. It accept incoming
    connections, peek into the first bytes sent to detect the protocol, and pass
    the connection to the server handling this protocol.

    To support a new protocol, register a detector object using 
    add_detector. Protocol detectors must implement this interface:

    class ProtocolDetector(object):

        NAME = "protocol name"

        # How many bytes are needed to detect this protocol
        REQUIRED_SIZE = 6

        def detect(self, data):
            """
            Given first bytes read from the connection, try to detect the 
            protocol. Returns True if protocol is detected.
            """ 

        def handleSocket(self, client_socket, socket_address):
            """
            Called after detect() succeeded. The detector owns the socket and
            is responsible for closing it.
            """
Line 45:     log = logging.getLogger("vds.MultiProtocolAcceptor")
Line 46: 
Line 47:     READ_ONLY_MASK = (select.POLLIN | select.POLLPRI | select.POLLHUP
Line 48:                       | select.POLLERR)


-- 
To view, visit http://gerrit.ovirt.org/28806
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9bc02d93dfec10e95e4dd2554b797376f3a7543
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: mooli tayer <mtayer at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list