// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-#if __GNUC__>= 3
- using namespace std;
-#endif
-
#include "TDOMParser.h"
#include "TSocket.h"
#include "TSystem.h"
//##################################################################################
Int_t AliHLTHOMERProxyHandler::Initialize() {
// see header file for class documentation
-
- Int_t iResult = 0 ;
-
IdentifyRealm();
-
- return iResult;
+ return 0;
}
/*
iResult = ProcessXmlRpcResponse();
if (iResult < 0) {
- HLTError(Form("Filling SourceList failed."));
+ HLTError("Filling SourceList failed.");
}
return iResult;
"alihlt-dcs0.cern.ch",
"alihlt-vobox0.cern.ch",
"alihlt-gw0.kip.uni-heidelberg.de",
- "localhost"
+ "localhost",
"portal-dcs1.internal",
"alihlt-dcs1.cern.ch",
"alihlt-vobox1.cern.ch",
// see header file for class documentation
TString hostIP(gSystem->GetHostByName(gSystem->HostName()).GetHostAddress());
+
+ HLTInfo(hostIP.Data());
if ( hostIP.Contains("10.162.") )
fRealm = kHLT;
fRealm = kACR;
else if ( hostIP.Contains("129.206.") )
fRealm = kKIP;
- else if ( hostIP.Contains("137.138") ||
- hostIP.Contains("128.141") ||
- hostIP.Contains("127.0.")
+ else if ( hostIP.Contains("137.138")
+ || hostIP.Contains("128.141")
+ || hostIP.Contains("127.0.")
+ || hostIP.Contains("192.168")
)
fRealm = kGPN;
else {
fRealm = kLoc;
}
+ //fRealm = kLoc;
+
return;
}
fgkHOMERProxyNode[fRealm], proxyPort,
fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort));
- fRealm = -1;
- return -1;
+ HLTWarning(Form("trying %s:%d now.",
+ fgkHOMERProxyNode[kLoc],proxyPort));
+ socket = new TSocket(fgkHOMERProxyNode[kLoc], proxyPort);
+ if ( ! socket->IsValid() ) {
+ HLTError(Form("Failed to create socket to %s:%d , %s:%d and %s:%d.",
+ fgkHOMERProxyNode[fRealm], proxyPort,
+ fgkHOMERProxyNode[fRealm+kHOMERRealmsMax],proxyPort,
+ fgkHOMERProxyNode[kLoc], proxyPort));
+ fRealm = -1;
+ return -1;
+ }
+ else {
+ fRealm = kLoc;
+ }
}
else
fRealm = fRealm+kHOMERRealmsMax;
// -- send request
// -----------------
- Char_t reqMsg[] = "PUT / HTTP/1.1\r\n\
+ Char_t reqMsg[] = "POST / HTTP/1.1\r\n\
User-Agent: curl/7.18.0 (x86_64-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1\r\n\
Host: localhost:10000\r\n\
Accept: */*\r\n\
iResult = socket->RecvRaw(&buffer[bufferLength], 1);
if ( iResult < 0) {
- HLTError(Form("Error reading form socket."));
+ HLTError("Error reading form socket.");
socket->Close();
return iResult;
}
TDOMParser xmlParser;
xmlParser.SetValidate(kFALSE);
- HLTDebug(Form("XMLResponse: %s",fXmlRpcResponse.Data()));
+ //NOTE Have to use a temporary variable for printing the XML responce,
+ // because Form might overrun its internal buffer and crash for large strings.
+ TString infoMsg = Form("XMLResponse: %s",fXmlRpcResponse.Data());
+ HLTInfo(infoMsg.Data());
iResult = xmlParser.ParseBuffer(fXmlRpcResponse.Data(), fXmlRpcResponse.Length());
if ( iResult < 0 ) {
GetChildren()->GetChildren()->GetChildren()->GetChildren();
if ( strcmp( node->GetNodeName(), "string" ) ) {
- HLTError(Form("No node 'string' in XmlRpcResponse."));
+ HLTError("No node 'string' in XmlRpcResponse.");
return -1;
}
}
if ( !xmlParser.GetXMLDocument()->GetRootNode()->HasChildren() ) {
- HLTWarning(Form("No Services active."));
+ HLTWarning("No Services active.");
return 1;
}
// -- Add service to list
iResult = AddService( serviceNode->GetChildren() );
if ( iResult > 0 ) {
- HLTWarning(Form("Incomplete Service not added."));
+ HLTWarning("Incomplete Service not added.");
iResult = 0;
}
} while ( ( serviceNode = prevServiceNode->GetNextNode() ) && !iResult );
Int_t iResult = 0;
- HLTInfo(Form(">> New service"));
+ HLTInfo(">> New service");
TXMLNode* serviceNode = innerNode;
// -- Change hostame from service with proxy, if outside HLT
- if ( fRealm != kHLT || fRealm != kHLT+kHOMERRealmsMax )
+ if ( fRealm != kHLT && fRealm != kHLT+kHOMERRealmsMax )
hostname = fgkHOMERProxyNode[fRealm];
TXMLNode* blocks = serviceNode->GetChildren();
if ( ! blocks ) {
- HLTError(Form("No blocks present"));
+ HLTError("No blocks present");
return 1;
}
TXMLNode* prevBlockNode = NULL;
if ( ! blockNode ) {
- HLTError(Form("No block present in the blocks tag"));
+ HLTError("No block present in the blocks tag");
return 1;
}
TXMLNode *prevDataNode = NULL;
if ( ! dataNode ) {
- HLTError(Form("No data specification tags present in block tag."));
+ HLTError("No data specification tags present in block tag.");
return 1;
}
// -- data spec loop