@@ -37,7 +37,7 @@ class Launcher : public PluginHost::IPlugin {
3737 Info (const uint8_t buffer[], const uint16_t length)
3838 : _status(PROC_CN_MCAST_IGNORE) {
3939 if (Ingest (buffer, length) == false ) {
40- printf (" This failed !!!!\n " );
40+ TRACE_L1 (" This failed !!!!\n " );
4141 _info.what = proc_event::PROC_EVENT_NONE;
4242 }
4343 }
@@ -129,7 +129,7 @@ class Launcher : public PluginHost::IPlugin {
129129
130130 public:
131131 Channel (ProcessObserver& parent)
132- : Core::SocketNetlink(Core::NodeId(NETLINK_CONNECTOR, ::getpid() , CN_IDX_PROC))
132+ : Core::SocketNetlink(Core::NodeId(NETLINK_CONNECTOR, 0 , CN_IDX_PROC))
133133 , _parent(parent) {
134134 }
135135 virtual ~Channel () {
@@ -179,37 +179,34 @@ class Launcher : public PluginHost::IPlugin {
179179 auto found = std::find (_callbacks.begin (), _callbacks.end (), observer);
180180 ASSERT (found != _callbacks.end ());
181181 _callbacks.erase (found);
182- if (_callbacks.empty ())
182+ if (_callbacks.empty ()) {
183183 Close ();
184+ }
184185 _adminLock.Unlock ();
185186 }
186187
187188 private:
188189 bool Open () {
189- bool succeeded = (_channel.IsOpen () == true );
190+ bool succeeded = true ;
191+ ASSERT (_channel.IsOpen () == false );
190192
191- if ((succeeded == false ) && ( _channel.Open (Core::infinite) == Core::ERROR_NONE) ) {
193+ if (_channel.Open (Core::infinite) == Core::ERROR_NONE) {
192194 Info message (true );
193195
194196 if (_channel.Send (message, Core::infinite) != Core::ERROR_NONE) {
195197 _channel.Close (Core::infinite);
196- }
197- else {
198- succeeded = true ;
198+ succeeded = false ;
199199 }
200200 }
201201 return (succeeded);
202202 }
203203 bool Close () {
204- bool succeeded = (_channel.IsOpen () == false );
205-
206- if (succeeded == false ) {
204+ if (_channel.IsOpen () == true ) {
207205
208206 Info message (false );
209207 _channel.Send (message, Core::infinite);
210- _channel.Close (Core::infinite);
211- succeeded = true ;
212208 }
209+ _channel.Close (Core::infinite);
213210
214211 return (Core::ERROR_NONE);
215212 }
@@ -260,11 +257,16 @@ class Launcher : public PluginHost::IPlugin {
260257 Launcher& _parent;
261258 };
262259
260+ public:
263261 class Config : public Core ::JSON::Container {
264262 private:
263+ Config (const Config&) = delete ;
264+ Config& operator =(const Config&) = delete ;
265+
266+ public:
265267 class Parameter : public Core ::JSON::Container {
266268 private:
267- Parameter& operator =(const Parameter&);
269+ Parameter& operator =(const Parameter&) = delete ;
268270
269271 public:
270272 Parameter ()
@@ -289,17 +291,16 @@ class Launcher : public PluginHost::IPlugin {
289291 Core::JSON::String Value;
290292 };
291293
292- Config (const Config&);
293- Config& operator =(const Config&);
294-
295294 public:
296295 Config ()
297296 : Core::JSON::Container()
298297 , Command()
299298 , Parameters()
299+ , CloseTime(3 )
300300 {
301301 Add (_T (" command" ), &Command);
302302 Add (_T (" parameters" ), &Parameters);
303+ Add (_T (" closetime" ), &CloseTime);
303304 }
304305 ~Config ()
305306 {
@@ -308,6 +309,7 @@ class Launcher : public PluginHost::IPlugin {
308309 public:
309310 Core::JSON::String Command;
310311 Core::JSON::ArrayType<Parameter> Parameters;
312+ Core::JSON::DecUInt8 CloseTime;
311313 };
312314
313315public:
@@ -317,6 +319,8 @@ class Launcher : public PluginHost::IPlugin {
317319 Launcher ()
318320 : _service(nullptr )
319321 , _process(false )
322+ , _pid(0 )
323+ , _closeTime(0 )
320324 , _notification(this )
321325 {
322326 }
@@ -359,8 +363,11 @@ class Launcher : public PluginHost::IPlugin {
359363private:
360364 PluginHost::IShell* _service;
361365 Core::Process _process;
362- static ProcessObserver _observer;
366+ uint32_t _pid;
367+ uint8_t _closeTime;
363368 Core::Sink<Notification> _notification;
369+
370+ static ProcessObserver _observer;
364371};
365372
366373} // namespace Plugin
0 commit comments