Compile fixes.

This commit is contained in:
Adam Ierymenko 2015-04-15 18:47:38 -07:00
parent 33c8d3c50b
commit 91ca238163
2 changed files with 8 additions and 7 deletions

View File

@ -41,9 +41,10 @@
#include "../node/Utils.hpp"
#include "../node/CertificateOfMembership.hpp"
#include "../node/NetworkConfig.hpp"
#include "../osdep/OSUtils.hpp"
// Include ZT_NETCONF_SCHEMA_SQL constant to init database
#include "netconf-schema.sql.c"
#include "schema.sql.c"
// Stored in database as schemaVersion key in Config.
// If not present, database is assumed to be empty and at the current schema version
@ -181,7 +182,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
Identity alreadyKnownIdentity((const char *)sqlite3_column_text(_sGetNodeIdentity,0));
if (alreadyKnownIdentity == identity) {
char lastSeen[64];
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)Utils::now());
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)OSUtils::now());
if (fromAddr) {
std::string lastAt(fromAddr.toString());
sqlite3_reset(_sUpdateNode);
@ -207,7 +208,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
if (fromAddr)
lastAt = fromAddr.toString();
char lastSeen[64];
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)Utils::now());
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)OSUtils::now());
sqlite3_reset(_sCreateNode);
sqlite3_bind_text(_sCreateNode,1,member.nodeId,10,SQLITE_STATIC);
sqlite3_bind_text(_sCreateNode,2,idstr.c_str(),-1,SQLITE_STATIC);
@ -304,7 +305,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
// Create and sign a new netconf, and save in database to re-use in the future
char tss[24],rs[24];
Utils::snprintf(tss,sizeof(tss),"%.16llx",(unsigned long long)Utils::now());
Utils::snprintf(tss,sizeof(tss),"%.16llx",(unsigned long long)OSUtils::now());
Utils::snprintf(rs,sizeof(rs),"%.16llx",(unsigned long long)network.revision);
netconf[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = tss;
netconf[ZT_NETWORKCONFIG_DICT_KEY_REVISION] = rs;
@ -458,7 +459,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
}
}
if (!netconf.sign(signingId)) {
if (!netconf.sign(signingId,OSUtils::now())) {
netconf["error"] = "unable to sign netconf dictionary";
return NETCONF_QUERY_INTERNAL_SERVER_ERROR;
}

View File

@ -715,10 +715,10 @@ int main(int argc,char **argv)
try {
controller = new SqliteNetworkController((homeDir + ZT_PATH_SEPARATOR_S + ZT1_CONTROLLER_DB_PATH).c_str());
} catch (std::exception &exc) {
fprintf(stderr,"%s: failure initializing SqliteNetworkController: %s"ZT_EOL_S,exc.what());
fprintf(stderr,"%s: failure initializing SqliteNetworkController: %s"ZT_EOL_S,argv[0],exc.what());
return 1;
} catch ( ... ) {
fprintf(stderr,"%s: failure initializing SqliteNetworkController: unknown exception"ZT_EOL_S);
fprintf(stderr,"%s: failure initializing SqliteNetworkController: unknown exception"ZT_EOL_S,argv[0]);
return 1;
}
#endif // ZT_ENABLE_NETWORK_CONTROLLER