diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-02-01 04:25:08 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-02-01 04:25:08 +0100 |
commit | af8fb6c3210f3c3923cdfe8660687f8a330dd6b2 (patch) | |
tree | 4657e9a399c3531727d7902e97d083fee65f198b /src/EtiReader.cpp | |
parent | fdff20e96d7198124542e6d03c27e1d496c4b328 (diff) | |
download | dabmod-af8fb6c3210f3c3923cdfe8660687f8a330dd6b2.tar.gz dabmod-af8fb6c3210f3c3923cdfe8660687f8a330dd6b2.tar.bz2 dabmod-af8fb6c3210f3c3923cdfe8660687f8a330dd6b2.zip |
Code cosmetics and udp multicast documentation
Diffstat (limited to 'src/EtiReader.cpp')
-rw-r--r-- | src/EtiReader.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp index 499e837..d1c7110 100644 --- a/src/EtiReader.cpp +++ b/src/EtiReader.cpp @@ -543,21 +543,25 @@ void EdiUdpInput::Open(const std::string& uri) { etiLog.level(info) << "Opening EDI :" << uri; size_t found_port = uri.find_first_of(":", 6); - if(found_port == string::npos) + if (found_port == string::npos) { throw std::invalid_argument("EDI input port must be provided"); + } - m_port =std::stoi(uri.substr(found_port+1)); - std::string host_full=uri.substr(6, found_port-6);// ignore udp:// + m_port = std::stoi(uri.substr(found_port+1)); + std::string host_full = uri.substr(6, found_port-6);// ignore udp:// size_t found_mcast = host_full.find_first_of("@"); //have multicast address: - if(found_mcast != string::npos) { - if(found_mcast>0) - m_bindto=host_full.substr(0,found_mcast); - m_mcastaddr=host_full.substr(found_mcast+1); - } else if(found_port != 6) { + if (found_mcast != string::npos) { + if (found_mcast > 0) { + m_bindto = host_full.substr(0, found_mcast); + } + m_mcastaddr = host_full.substr(found_mcast+1); + } + else if (found_port != 6) { m_bindto=host_full; } - etiLog.level(info) << "EDI input: host:" << m_bindto << ", source:" << m_mcastaddr << ", port:" << m_port; + etiLog.level(info) << "EDI input: host:" << m_bindto << + ", source:" << m_mcastaddr << ", port:" << m_port; // The max_fragments_queued is only a protection against a runaway // memory usage. |