mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Validate connection method per endpoint, not socket
this allows e.g. to ommit the socket method in config if all endpoints specify the method modifier. It still is fully backward compatible.
This commit is contained in:
parent
892aa8008b
commit
94a4d599eb
|
@ -390,17 +390,6 @@ bool FairMQChannel::ValidateChannel()
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// validate socket method
|
||||
const string socketMethodNames[] = { "bind", "connect" };
|
||||
const set<string> socketMethods(socketMethodNames, socketMethodNames + sizeof(socketMethodNames) / sizeof(string));
|
||||
if (socketMethods.find(fMethod) == socketMethods.end())
|
||||
{
|
||||
ss << "INVALID";
|
||||
LOG(DEBUG) << ss.str();
|
||||
LOG(ERROR) << "Invalid channel method: \"" << fMethod << "\"";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// validate socket address
|
||||
if (fAddress == "unspecified" || fAddress == "")
|
||||
{
|
||||
|
@ -421,7 +410,17 @@ bool FairMQChannel::ValidateChannel()
|
|||
if (endpoint[0]=='@'||endpoint[0]=='+'||endpoint[0]=='>') {
|
||||
address = endpoint.substr(1);
|
||||
} else {
|
||||
address = endpoint;
|
||||
// we don't have a method modifier, check if the default method is set
|
||||
const string socketMethodNames[] = { "bind", "connect" };
|
||||
const set<string> socketMethods(socketMethodNames, socketMethodNames + sizeof(socketMethodNames) / sizeof(string));
|
||||
if (socketMethods.find(fMethod) == socketMethods.end())
|
||||
{
|
||||
ss << "INVALID";
|
||||
LOG(DEBUG) << ss.str();
|
||||
LOG(ERROR) << "Invalid endpoint connection method: \"" << fMethod << "\" for " << endpoint;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
address = endpoint;
|
||||
}
|
||||
// check if address is a tcp or ipc address
|
||||
if (address.compare(0, 6, "tcp://") == 0)
|
||||
|
|
|
@ -208,6 +208,15 @@ void FairMQDevice::InitWrapper()
|
|||
// fill the uninitialized list
|
||||
uninitializedConnectingChannels.push_back(&(*vi));
|
||||
}
|
||||
else if (vi->fAddress.find_first_of("@+>") != string::npos)
|
||||
{
|
||||
// set channel name: name + vector index
|
||||
stringstream ss;
|
||||
ss << mi->first << "[" << vi - (mi->second).begin() << "]";
|
||||
vi->fChannelName = ss.str();
|
||||
// fill the uninitialized list
|
||||
uninitializedConnectingChannels.push_back(&(*vi));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Cannot update configuration. Socket method (bind/connect) not specified.";
|
||||
|
|
Loading…
Reference in New Issue
Block a user