From f2b6ccd6ace0bc44a455730c880b1642bef31aff Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Sat, 29 Apr 2006 16:50:15 +0000 Subject: [PATCH] simple changes, gettimeofday -> Utility::gettimeofday etc git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@795 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- pdns/selectmplexer.cc | 3 ++- pdns/sstuff.hh | 8 ++++---- pdns/syncres.hh | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pdns/selectmplexer.cc b/pdns/selectmplexer.cc index a860c51d9..be330ce3c 100644 --- a/pdns/selectmplexer.cc +++ b/pdns/selectmplexer.cc @@ -5,6 +5,7 @@ #include "misc.hh" #include #include "syncres.hh" +#include "utility.hh" using namespace boost; using namespace std; @@ -64,7 +65,7 @@ int SelectFDMultiplexer::run(struct timeval* now) struct timeval tv={0,500000}; int ret=select(fdmax + 1, &readfds, &writefds, 0, &tv); - gettimeofday(now, 0); + Utility::gettimeofday(now, 0); if(ret < 0 && errno!=EINTR) throw FDMultiplexerException("select returned error: "+stringerror()); diff --git a/pdns/sstuff.hh b/pdns/sstuff.hh index 636ed28c8..0cdfa50e0 100755 --- a/pdns/sstuff.hh +++ b/pdns/sstuff.hh @@ -7,10 +7,12 @@ #include #include #include +#ifndef WIN32 #include #include #include #include +#endif #include #include #include @@ -44,7 +46,7 @@ public: IPAddress(const string &remote) { struct in_addr addr; - if(!inet_aton(remote.c_str(), &addr)) + if(!Utility::inet_aton(remote.c_str(), &addr)) throw NetworkError("Could not convert '"+remote+"' to an IP address"); byte=addr.s_addr; } @@ -131,9 +133,7 @@ public: //! Set the socket to non-blocking void setNonBlocking() { - int flags=fcntl(d_socket,F_GETFL,0); - if(flags<0 || fcntl(d_socket, F_SETFL,flags|O_NONBLOCK) <0) - throw NetworkError("Setting socket to nonblocking: "+string(strerror(errno))); + Utility::setNonBlocking(d_socket); } //! Bind the socket to a specified endpoint diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 5bed103aa..c937e26d4 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -115,7 +115,7 @@ public: return *tv; else { struct timeval ret; - gettimeofday(&ret, 0); + Utility::gettimeofday(&ret, 0); return ret; } } @@ -163,7 +163,7 @@ class PulseRate public: PulseRate() : d_val(0.0) { - gettimeofday(&d_last, 0); + Utility::gettimeofday(&d_last, 0); } PulseRate(const PulseRate& orig) : d_last(orig.d_last), d_val(orig.d_val) -- 2.40.0