mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
FairMQ: Remove unused Attach method and unused socket flags
This commit is contained in:
committed by
Mohammad Al-Turany
parent
3785c0e369
commit
3670dd8835
@@ -1,80 +1,9 @@
|
||||
/********************************************************************************
|
||||
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* Copyright (C) 2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||
* *
|
||||
* This software is distributed under the terms of the *
|
||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
/**
|
||||
* FairMQSocket.cxx
|
||||
*
|
||||
* @since 2012-12-05
|
||||
* @author D. Klein, A. Rybalchenko
|
||||
*/
|
||||
|
||||
#include "FairMQSocket.h"
|
||||
#include <cstring>
|
||||
|
||||
bool FairMQSocket::Attach(const std::string& config, bool serverish)
|
||||
{
|
||||
if (config.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (config.size() < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* endpoints = config.c_str();
|
||||
|
||||
// We hold each individual endpoint here
|
||||
char endpoint [256];
|
||||
while (*endpoints)
|
||||
{
|
||||
const char *delimiter = strchr(endpoints, ',');
|
||||
if (!delimiter)
|
||||
{
|
||||
delimiter = endpoints + strlen(endpoints);
|
||||
}
|
||||
if (delimiter - endpoints > 255)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
memcpy(endpoint, endpoints, delimiter - endpoints);
|
||||
endpoint[delimiter - endpoints] = 0;
|
||||
|
||||
bool rc = false;
|
||||
|
||||
if (endpoint [0] == '@')
|
||||
{
|
||||
rc = Bind(endpoint + 1);
|
||||
}
|
||||
else if (endpoint [0] == '>' || endpoint [0] == '-' || endpoint [0] == '+' )
|
||||
{
|
||||
Connect(endpoint + 1);
|
||||
}
|
||||
else if (serverish)
|
||||
{
|
||||
rc = Bind(endpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
Connect(endpoint);
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*delimiter == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
endpoints = delimiter + 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#include <FairMQSocket.h>
|
||||
|
Reference in New Issue
Block a user