From 92a62fbfe18e446b5017ff8b37ad26e5e43d4f7c Mon Sep 17 00:00:00 2001 From: Coleman Link Date: Wed, 19 Sep 2018 13:56:00 -0400 Subject: [PATCH 1/5] Fixed a bug where the INS geolocation was set to the contents of the GPS geolocation field. This was causing exceptions when processing VITA context packets that had an INS geolocation field included, but no geolocation GPS field. --- cpp/SourceVITA49.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/SourceVITA49.cpp b/cpp/SourceVITA49.cpp index b1b9c67..0702bed 100644 --- a/cpp/SourceVITA49.cpp +++ b/cpp/SourceVITA49.cpp @@ -1658,7 +1658,7 @@ void SourceVITA49_i::process_context(std::vector *packet) { Geolocation Temp = contextPacket_g->getGeolocationINS(); if (processingGEOINS != Temp) { - processingGEOINS = contextPacket_g->getGeolocationGPS(); + processingGEOINS = contextPacket_g->getGeolocationINS(); TimeStamp geo_ins_time; geo_ins_time = processingGEOINS.getTimeStamp(); From 033b1120c43b7cf9a8ac8f2a4c8f3d65c30a010b Mon Sep 17 00:00:00 2001 From: Coleman Link Date: Wed, 19 Sep 2018 13:58:18 -0400 Subject: [PATCH 2/5] Added section to 'process_context' function to update output SRI mode based on the data payload format type specified in the VITA context packet being processed. --- cpp/SourceVITA49.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/SourceVITA49.cpp b/cpp/SourceVITA49.cpp index 0702bed..6e0b15e 100644 --- a/cpp/SourceVITA49.cpp +++ b/cpp/SourceVITA49.cpp @@ -1417,6 +1417,12 @@ void SourceVITA49_i::process_context(std::vector *packet) { rebase_pointer_context(packet); + PayloadFormat format = contextPacket_g->getDataPayloadFormat(); + + if(!isNull(format)){ + outputSRI.mode = format.getRealComplexType(); + } + if (!isNull(contextPacket_g->getStreamID()) && streamID.empty()) { streamID = contextPacket_g->getStreamID(); } From c2ce3dddd048a7626689c46e52988507357e407c Mon Sep 17 00:00:00 2001 From: Coleman Link Date: Wed, 19 Sep 2018 14:02:01 -0400 Subject: [PATCH 3/5] Modified 'attach' method to actually ignore new attachments, rather than just logging a message about ignoring then and replacing the old attatchment's settings anyway. --- cpp/SourceVITA49.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/SourceVITA49.cpp b/cpp/SourceVITA49.cpp index 6e0b15e..f7e8d28 100644 --- a/cpp/SourceVITA49.cpp +++ b/cpp/SourceVITA49.cpp @@ -1208,6 +1208,7 @@ throw (BULKIO::dataVITA49::AttachError, BULKIO::dataVITA49::StreamInputError) { if (!attach_port_settings.attach_id.empty()) { LOG_ERROR(SourceVITA49_i, "Already has an attached connection! Latest attachment ignored!") + return CORBA::string_dup(curr_attach.attach_id.c_str()); } initialize_values(); From 01702d06bc24b5e7fd4584f55782925f840466bf Mon Sep 17 00:00:00 2001 From: Coleman Link Date: Wed, 19 Sep 2018 14:04:00 -0400 Subject: [PATCH 4/5] Modified 'launch_rx_thread' function to close existing sockets before opening new ones in their place. --- cpp/SourceVITA49.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cpp/SourceVITA49.cpp b/cpp/SourceVITA49.cpp index f7e8d28..2721136 100644 --- a/cpp/SourceVITA49.cpp +++ b/cpp/SourceVITA49.cpp @@ -1110,6 +1110,11 @@ bool SourceVITA49_i::launch_rx_thread() { if (attachedIP > lowMulti && attachedIP < highMulti && !curr_attach.ip_address.empty()) { LOG_DEBUG(SourceVITA49_i, "Enabling multicast_client on " << attachedInterface << " " << attachedIPstr << " " << curr_attach.port); + + if(multicast_udp_open) { + multicast_close(multi_client); + } + multi_client = multicast_client(attachedInterface, attachedIPstr, curr_attach.port); if (multi_client.sock < 0) { @@ -1120,6 +1125,11 @@ bool SourceVITA49_i::launch_rx_thread() { multicast_udp_open = true; } else if (!curr_attach.use_udp_protocol) { LOG_DEBUG(SourceVITA49_i, "Enabling unicast TCP client on " << attachedInterface << " " << attachedIPstr << " " << curr_attach.port); + + if(unicast_tcp_open) { + unicast_tcp_close(tcp_client); + } + tcp_client = unicast_tcp_client(attachedInterface, attachedIPstr, curr_attach.port); if (tcp_client.sock < 0) { @@ -1130,6 +1140,11 @@ bool SourceVITA49_i::launch_rx_thread() { unicast_tcp_open = true; } else { LOG_DEBUG(SourceVITA49_i, "Enabling unicast UDP client on " << attachedInterface << " " << attachedIPstr << " " << curr_attach.port); + + if(unicast_udp_open) { + unicast_close(uni_client); + } + uni_client = unicast_client(attachedInterface, attachedIPstr, curr_attach.port); if (uni_client.sock < 0) { From 4303604ac77d64a776b9fb9dcf7776cc70e9653b Mon Sep 17 00:00:00 2001 From: Coleman Link Date: Wed, 19 Sep 2018 14:06:43 -0400 Subject: [PATCH 5/5] Modified VITA49 source to lock the 'sriLock' mutex in a couple places where the current SRI (which it protects) was being modified. --- cpp/SourceVITA49.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/SourceVITA49.cpp b/cpp/SourceVITA49.cpp index 2721136..f476c65 100644 --- a/cpp/SourceVITA49.cpp +++ b/cpp/SourceVITA49.cpp @@ -624,7 +624,9 @@ void SourceVITA49_i::attachmentOverrideChanged(const attachment_override_struct* attach_override_settings.use_udp_protocol = attachment_override.use_udp_protocol; streamID = attach_override_settings.attach_id; //"manual_override"; + boost::mutex::scoped_lock sri_lock(sriLock); currSRI.streamID = streamID.c_str(); + sri_lock.unlock(); destroy_rx_thread(); @@ -1009,6 +1011,8 @@ double SourceVITA49_i::timeDiff() { * ******************************************************************************************/ void SourceVITA49_i::setDefaultSRI() { + boost::mutex::scoped_lock lock(sriLock); + currSRI.hversion = 0; /* time between samples (inverse of sample rate) */ currSRI.xdelta = (double) 0;