Skip to content

Commit

Permalink
shm_driver: remove time_ref topic parameter to improve secutiry, plea…
Browse files Browse the repository at this point in the history
…se use remap

Fixes #9
  • Loading branch information
vooon committed Dec 30, 2022
1 parent b8b9e1d commit 063eb91
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<ros_api>
<sub name="~/time_ref" type="sensor_msgs/TimeReference">Time source topic. (default topic name)</sub>
<param name="~/shm_unit" type="int" default="2">SHM Unit (must be same as in ntp server config).</param>
<param name="~/time_ref_topic" type="string" default="time_ref">Topic name (may be used instead of remap).</param>
<param name="~/fixup_date" type="bool" default="false">Enable date fixup.</param>
</ros_api>
</node>
Expand Down
5 changes: 1 addition & 4 deletions src/shm_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,23 @@ int main(int argc, char *argv[])
ros::Subscriber time_ref_sub;

int shm_unit;
std::string time_ref_topic;

// Override default ROS handler
signal(SIGINT, sig_handler);

// Read Parameters
nh.param("shm_unit", shm_unit, 2);
nh.param("fixup_date", g_set_date, false);
nh.param<std::string>("time_ref_topic", time_ref_topic, "time_ref");

// Report settings
ROS_INFO_STREAM("NTP time source: " << ros::names::resolve(time_ref_topic, true));
ROS_INFO_STREAM("NTP date fixup: " << ((g_set_date) ? "enabled" : "disabled"));

g_shm = get_shmTime(shm_unit);
if (g_shm == NULL)
return 1;

// prefer to unreliable connection, but accept tcp too.
time_ref_sub = nh.subscribe(time_ref_topic, 10, time_ref_cb,
time_ref_sub = nh.subscribe("time_ref", 10, time_ref_cb,
ros::TransportHints()
.unreliable().maxDatagramSize(1024)
.reliable().tcpNoDelay(true));
Expand Down

0 comments on commit 063eb91

Please sign in to comment.