@@ -79,37 +79,38 @@ namespace opencover
7979 OpenThreads::ScopedLock<OpenThreads::Mutex> lock (mutex);
8080 int numToAdd = toAdd.size ();
8181 coVRMSController::instance ()->syncData (&numToAdd, sizeof (numToAdd));
82- if (coVRMSController::instance ()->isMaster ())
83- {
84- for (const auto &i:toAdd)
85- {
86- devices.push_back (i);
87- int len = i->pluginName .length ();
88- coVRMSController::instance ()->sendSlaves (&len, sizeof (len));
89- coVRMSController::instance ()->sendSlaves (i->pluginName .c_str (), len + 1 );
90- cover->addPlugin (i->pluginName .c_str ());
91- }
92- }
93- else
94- {
95- for ( int i= 0 ;i<numToAdd;i++)
96- {
97- std::string pluginName;
98- int len = 0 ;
99- char buf[ 1000 ];
100- coVRMSController::instance ()-> readMaster (&len, sizeof (len));
101- coVRMSController::instance ()-> readMaster (buf, len+ 1 );
102- cover-> addPlugin (buf);
103- }
104- }
105- toAdd. clear () ;
106- auto firstNew = devices. end () - numToAdd ;
107- for ( int i = 0 ; i < numToAdd; i++)
108- {
109- deviceAdded (*firstNew);
110- ++firstNew;
111- }
82+ if (coVRMSController::instance ()->isMaster ())
83+ {
84+ for (const auto &i:toAdd)
85+ {
86+ devices.push_back (i);
87+ int len = i->pluginName .length ();
88+ coVRMSController::instance ()->sendSlaves (&len, sizeof (len));
89+ coVRMSController::instance ()->sendSlaves (i->pluginName .c_str (), len + 1 );
90+ cover->addPlugin (i->pluginName .c_str ());
91+ }
92+ auto firstNew = devices. end () - numToAdd;
93+ for ( int i = 0 ; i < numToAdd; i++)
94+ {
95+ deviceAdded (*firstNew);
96+ ++firstNew;
97+ }
98+ }
99+ else
100+ {
101+ for ( int i= 0 ;i<numToAdd;i++)
102+ {
103+ std::string pluginName;
104+ int len = 0 ;
105+ char buf[ 1000 ] ;
106+ coVRMSController::instance ()-> readMaster (&len, sizeof (len)) ;
107+ coVRMSController::instance ()-> readMaster (buf, len+ 1 );
108+ cover-> addPlugin (buf);
109+ }
110+ }
111+ toAdd. clear ();
112112 }
113+
113114 void deviceDiscovery::run ()
114115 {
115116 covise::setThreadName (" deviceDiscoveryThread" );
0 commit comments