Changeset 262 for Evidence/Bridge.cc
- Timestamp:
- 07/26/10 17:53:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Bridge.cc
r253 r262 50 50 51 51 public: 52 Bridge( char *, int);52 Bridge(); 53 53 ~Bridge(); 54 54 }; 55 55 56 // Constructor 57 Bridge::Bridge(char *Name, int Port): EvidenceServer(SERVER_NAME) { 58 59 // Set primary DIM network to subscribe from 60 DimClient::setDnsNode(Name, Port); 61 62 // Initialise and request notification of configuration changes 56 // Constructor (ConfigChanged() is automatically called at start-up) 57 Bridge::Bridge(): EvidenceServer(SERVER_NAME) { 58 59 // Initialise 63 60 ServerList = NULL; 64 61 GetConfig("cmdallow", " "); 65 ActivateSignal(SIGUSR2);66 67 ConfigChanged();68 62 } 69 63 … … 92 86 93 87 // Check if configuratiomn changed 94 if (ExcludeString == GetConfig("exclude")) return; 95 ExcludeString = GetConfig("exclude"); 96 97 // Remove all previous subscriptions 98 Undo(); 99 88 string NewExcludeString = GetConfig("exclude"); 89 90 Lock(); 91 if (ExcludeString != NewExcludeString) ExcludeString.swap(NewExcludeString); 92 Unlock(); 93 if (ExcludeString == NewExcludeString) return; 94 100 95 // Compile regular expressions 101 96 regex_t R; 97 vector<regex_t> RegEx; 98 102 99 vector<string> Exclude = Tokenize(ExcludeString, " \t"); 103 100 for (int i=0; i<Exclude.size(); i++) { … … 111 108 } 112 109 113 // Subscribe to top-level server list 110 // Remove previous data, set new regular expressions and subscribe to top-level server list 111 Lock(); 112 Undo(); 113 Bridge::RegEx = RegEx; 114 114 ServerList = new DimInfo((char *) "DIS_DNS/SERVER_LIST", NO_LINK, this); 115 Unlock(); 115 116 } 116 117 … … 267 268 exit(EXIT_FAILURE); 268 269 } 269 270 271 // Set primary DIM network to subscribe from 272 DimClient::setDnsNode(argv[1], argc>2 ? atoi(argv[2]) : DEFAULT_PORT); 273 270 274 // Static ensures calling of destructor by exit() 271 static Bridge Class (argv[1], argc>2 ? atoi(argv[2]) : DEFAULT_PORT);275 static Bridge Class; 272 276 273 277 // Sleep until signal caught
Note:
See TracChangeset
for help on using the changeset viewer.