Changeset 414 in flair-src for trunk/lib/FlairCore
- Timestamp:
- Mar 26, 2021, 11:31:57 AM (4 years ago)
- Location:
- trunk/lib/FlairCore/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
r313 r414 221 221 return; 222 222 } 223 if(address=="autodetect") { 224 Printf("autodetecting gcs ip address based on ssh connection\n"); 225 address=AutoDetectGCS(); 226 } 223 227 this->address=address; 224 228 this->port=port; … … 246 250 gcs_watchdog = new Watchdog(this, std::bind(&FrameworkManager_impl::SetConnectionLost, this),watchdogTimeout); 247 251 gcs_watchdog->Start(); 252 } 253 254 string FrameworkManager_impl::AutoDetectGCS(void) { 255 FILE *fp; 256 char result[15]; 257 258 //get only first result and remove line feed 259 fp = popen("who | awk '{ print $7; }' | head -n 1 | tr -d '\n'", "r"); 260 if (fp == NULL) { 261 Err("Failed to run autodetect command\n" ); 262 } 263 264 fgets(result, sizeof(result), fp); 265 pclose(fp); 266 267 return result; 248 268 } 249 269 … … 295 315 // it switches back to RT in ProcessXML when mutex are locked 296 316 void FrameworkManager_impl::Run(void) { 317 318 if (self->ErrorOccured() == true) { 319 return ; 320 } 321 322 297 323 while (!ToBeStopped()) { 298 324 ssize_t bytesRead; -
trunk/lib/FlairCore/src/unexported/FrameworkManager_impl.h
r254 r414 90 90 void SaveXmlChange(char *buf); 91 91 void SaveXml(void); 92 std::string AutoDetectGCS(void); 92 93 size_t rcv_buf_size; 93 94 char *rcv_buf;
Note:
See TracChangeset
for help on using the changeset viewer.