From 2992e1b10070fc2da51db8bcb6a0570ef4846ded Mon Sep 17 00:00:00 2001 From: Hans Kunkell <hansk@mailfence.com> Date: Sat, 25 Jul 2020 23:19:07 +0900 Subject: [PATCH] implements reinit of IO channels --- src/Main/fg_io.cxx | 6 ++++++ src/Network/protocol.cxx | 5 +++++ src/Network/protocol.hxx | 1 + 3 files changed, 12 insertions(+) diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index a5c8a4d2f..4824d718b 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -383,6 +383,12 @@ FGProtocol* FGIO::add_channel(const string& config) void FGIO::reinit() { + SG_LOG(SG_IO, SG_INFO, "FGIO::reinit()"); + + std::for_each(io_channels.begin(), io_channels.end(), [](FGProtocol* p) { + SG_LOG(SG_IO, SG_INFO, "Restarting channel \"" << p->get_name() << "\""); + p->reinit(); + }); } // process any IO channel work diff --git a/src/Network/protocol.cxx b/src/Network/protocol.cxx index 06247d71b..1419430c1 100644 --- a/src/Network/protocol.cxx +++ b/src/Network/protocol.cxx @@ -81,6 +81,11 @@ bool FGProtocol::close() { return false; } +// dummy reinit routine +void FGProtocol::reinit() +{ + SG_LOG(SG_IO, SG_INFO, "dummy FGProtocol::reinit()"); +} // standard I/O channel close routine bool FGProtocol::gen_message() { diff --git a/src/Network/protocol.hxx b/src/Network/protocol.hxx index 20a981d79..d5d37fbc9 100644 --- a/src/Network/protocol.hxx +++ b/src/Network/protocol.hxx @@ -65,6 +65,7 @@ public: virtual bool open(); virtual bool process(); virtual bool close(); + virtual void reinit(); inline SGProtocolDir get_direction() const { return dir; } void set_direction( const string& d );