Ejemplo n.º 1
0
 def initAsClient( self ):
   retVal = gSocketInfoFactory.getSocket( self.stServerAddress, **self.extraArgsDict )
   if not retVal[ 'OK' ]:
     return retVal
   self.oSocketInfo = retVal[ 'Value' ]
   self.oSocket = self.oSocketInfo.getSSLSocket()
   if not self.oSocket.session_reused():
     gLogger.debug( "New session connecting to server at %s" % str( self.stServerAddress ) )
   self.remoteAddress = self.oSocket.getpeername()
   return S_OK()
Ejemplo n.º 2
0
 def initAsClient( self ):
   retVal = gSocketInfoFactory.getSocket( self.stServerAddress, **self.extraArgsDict )
   if not retVal[ 'OK' ]:
     return retVal
   self.oSocketInfo = retVal[ 'Value' ]
   self.oSocket = self.oSocketInfo.getSSLSocket()
   if not self.oSocket.session_reused():
     gLogger.debug( "New session connecting to server at %s" % str( self.stServerAddress ) )
   self.remoteAddress = self.oSocket.getpeername()
   return S_OK()
Ejemplo n.º 3
0
 def createClientSocket( self, addressTuple , **kwargs ):
   if type( addressTuple ) not in ( types.ListType, types.TupleType ):
     return S_ERROR( "hostAdress is not in a tuple form ( 'hostnameorip', port )" )
   self.__checkKWArgs( kwargs )
   result = checkSanity( addressTuple, kwargs )
   if not result[ 'OK' ]:
     return result
   result = gSocketInfoFactory.getSocket( addressTuple, **kwargs )
   if not result[ 'OK' ]:
     return result
   socketInfo = result[ 'Value' ]
   return S_OK( FakeSocket( socketInfo.getSSLSocket(), copies = 1 ) )
Ejemplo n.º 4
0
 def createClientSocket( self, addressTuple , **kwargs ):
   if type( addressTuple ) not in ( types.ListType, types.TupleType ):
     return S_ERROR( "hostAdress is not in a tuple form ( 'hostnameorip', port )" )
   res = gConfig.getOptionsDict( "/DIRAC/ConnConf/%s:%s" % addressTuple[0:2] )
   if res[ 'OK' ]:
     opts = res[ 'Value' ]
     for k in opts:
       if k not in kwargs:
         kwargs[k] = opts[k]
   self.__checkKWArgs( kwargs )
   result = checkSanity( addressTuple, kwargs )
   if not result[ 'OK' ]:
     return result
   result = gSocketInfoFactory.getSocket( addressTuple, **kwargs )
   if not result[ 'OK' ]:
     return result
   socketInfo = result[ 'Value' ]
   return S_OK( FakeSocket( socketInfo.getSSLSocket(), copies = 1 ) )
Ejemplo n.º 5
0
 def createClientSocket(self, addressTuple, **kwargs):
     if type(addressTuple) not in (types.ListType, types.TupleType):
         return S_ERROR(
             "hostAdress is not in a tuple form ( 'hostnameorip', port )")
     res = gConfig.getOptionsDict("/DIRAC/ConnConf/%s:%s" % addressTuple)
     if res['OK']:
         opts = res['Value']
         for k in opts:
             if k not in kwargs:
                 kwargs[k] = opts[k]
     self.__checkKWArgs(kwargs)
     result = checkSanity(addressTuple, kwargs)
     if not result['OK']:
         return result
     result = gSocketInfoFactory.getSocket(addressTuple, **kwargs)
     if not result['OK']:
         return result
     socketInfo = result['Value']
     return S_OK(FakeSocket(socketInfo.getSSLSocket(), copies=1))