add pdns.now timeval struct to recursor lua #3437

Merged
merged 1 commit into from Feb 24, 2016

Projects

None yet

2 participants

@Habbie
Member
Habbie commented Feb 23, 2016

Not sure this is the best way - perhaps adding a pdns.now just containing that int (or float) would be better?

UPDATE: have that now.

@Habbie Habbie changed the title from add Lua pdnsunixtime() function which returns int g_now.tv_sec to add pdns.now timeval struct to recursor lua Feb 23, 2016
@Habbie
Member
Habbie commented Feb 24, 2016

Ready for review and merge.

@ahupowerdns ahupowerdns and 1 other commented on an outdated diff Feb 24, 2016
pdns/lua-recursor4.cc
@@ -54,6 +54,8 @@ int RecursorLua4::gettag(const ComboAddress& remote, const ComboAddress& local,
#undef L
#include "ext/luawrapper/include/LuaContext.hpp"
+extern __thread struct timeval g_now; // timestamp, updated (too) frequently
@ahupowerdns
ahupowerdns Feb 24, 2016 Member

this is asking for problems since it might get out of sync, perhaps put this in syncres.hh?

@Habbie
Habbie Feb 24, 2016 Member

will do

@ahupowerdns ahupowerdns commented on the diff Feb 24, 2016
pdns/lua-recursor4.cc
@@ -336,6 +338,10 @@ RecursorLua4::RecursorLua4(const std::string& fname)
for(const auto& n : QType::names)
pd.push_back({n.first, n.second});
+ pd.push_back({"now", &g_now});
@Habbie
Member
Habbie commented Feb 24, 2016

Nit handled, squashed.

@ahupowerdns ahupowerdns merged commit 3fbf027 into PowerDNS:master Feb 24, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Habbie Habbie deleted the Habbie:lua-pdnsunixtime branch Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment