add timeval struct to recursor lua #3437

merged 1 commit into from Feb 24, 2016


None yet

2 participants

Habbie commented Feb 23, 2016

Not sure this is the best way - perhaps adding a 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 timeval struct to recursor lua Feb 23, 2016
Habbie commented Feb 24, 2016

Ready for review and merge.

@ahupowerdns ahupowerdns and 1 other commented on an outdated diff Feb 24, 2016
@@ -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 Feb 24, 2016 Member

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

Habbie Feb 24, 2016 Member

will do

@ahupowerdns ahupowerdns commented on the diff Feb 24, 2016
@@ -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 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
@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