MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / refresh

Method refresh

Peering/NeighborTable.cpp:228–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226
227
228void NeighborTable::refresh()
229{
230 if (mDB == NULL) { return; } // we already threw an ALERT.
231 fill();
232 time_t now = time(NULL);
233 time_t then = now - gConfig.getNum("Peering.Neighbor.RefreshAge");
234 char query[400];
235 sprintf(query,"SELECT IPADDRESS FROM NEIGHBOR_TABLE WHERE UPDATED < %u",(unsigned)then);
236 sqlite3_stmt *stmt;
237 if (sqlite3_prepare_statement(mDB,&stmt,query)) {
238 LOG(ALERT) << "read of neighbor table failed: " << query;
239 return;
240 }
241 int src = sqlite3_step(stmt);
242 while (src==SQLITE_ROW) {
243 const char* addrString = (const char*)sqlite3_column_text(stmt,0);
244 if (!addrString) {
245 LOG(ALERT) << "null address in neighbor table";
246 src = sqlite3_step(stmt);
247 continue;
248 }
249 struct sockaddr_in address;
250 if (!resolveAddress(&address, addrString)) {
251 LOG(ALERT) << "cannot resolve neighbor address " << addrString;
252 src = sqlite3_step(stmt);
253 continue;
254 }
255 LOG(INFO) << "sending neighbor param request to " << addrString;
256 gPeerInterface.sendNeighborParamsRequest(&address);
257 src = sqlite3_step(stmt);
258 }
259 sqlite3_finalize(stmt);
260}
261
262
263string NeighborTable::getAddress(unsigned BCCH_FREQ_NCELL, unsigned BSIC)

Callers 1

serviceLoop1Method · 0.80

Calls 1

Tested by

no test coverage detected