BaseTransport

Hosts BaseTransport class, which is a base for PlainTransport and SSLTransport

BaseTransport is used by the client and the service, it describes an opened connection. Here a diagram of basic Client/Service exchange

Client -> ServiceReactor : Connect

Client<–>Service : Handshake (only in SSLTransport)

Client -> Service : Propose action

Client <- Service : S_OK

Client -> RequestHandler : Arguments

Client <- RequestHandler : Response

Client <- Service : Close

class DIRAC.Core.DISET.private.Transports.BaseTransport.BaseTransport(stServerAddress, bServerMode=False, **kwargs)

Bases: object

Invokes MixedEncode for marshaling/unmarshaling of data calls in transit

__init__(stServerAddress, bServerMode=False, **kwargs)
bAllowReuseAddress = True
close()
getAppData()
getConnectingCredentials()
Returns:

dictionary with credentials

Return empty dictionary for plainTransport.

In SSLTransport it contains (after the handshake):

  • ’DN’ : All identity name, e.g. `/C=ch/O=DIRAC/OU=DIRAC CI/CN=ciuser`

  • ’CN’ : Only the user name e.g. ciuser

  • ’x509Chain’ : List of all certificates in the chain

  • ’isProxy’ : True if the client use proxy certificate

  • ’isLimitedProxy’ : True if the client use limited proxy certificate

  • ’group’ (optional): Dirac group attached to the client

  • ’extraCredentials’ (optional): Extra credentials if exists

Before the handshake, dictionary is empty

getFormattedCredentials()
getKeepAliveLapse()
getLastActionTimestamp()
getLocalAddress()
getRemoteAddress()
getSocket()
handshake()

This method is overwritten by SSLTransport if we use a secured transport.

iListenQueueSize = 128
iReadTimeout = 600
keepAliveMagic = b'dka'
latestServerRenewTime()
receiveData(maxBufferSize=0, blockAfterKeepAlive=True, idleReceive=False)
renewServerContext()
sendData(uData, prefix=b'')
sendKeepAlive(responseId=None, now=False)
serverMode()
setAppData(appData)
setExtraCredentials(extraCredentials)

Add extra credentials to peerCredentials

Parameters:

extraCredentials (str or tuple) – group or tuple with DN and group

setSocketTimeout(timeout)

This method has to be overwritten, if we want to increase the socket timeout.