]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Remove unused waitFor2Data(). Superseded by waitForMultiData().
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 4 Aug 2025 07:28:26 +0000 (09:28 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 4 Aug 2025 09:49:16 +0000 (11:49 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/misc.cc
pdns/misc.hh

index e3cf96097c5249e87d6f7d6ad4cd5fa461938cb9..f22e3ff00e293e07ba50d40031786cde6229c2b0 100644 (file)
@@ -388,46 +388,6 @@ int waitForMultiData(const set<int>& fds, const int seconds, const int mseconds,
   return 1;
 }
 
-// returns -1 in case of error, 0 if no data is available, 1 if there is. In the first two cases, errno is set
-int waitFor2Data(int fd1, int fd2, int seconds, int mseconds, int* fdPtr)
-{
-  std::array<pollfd,2> pfds{};
-  memset(pfds.data(), 0, pfds.size() * sizeof(struct pollfd));
-  pfds[0].fd = fd1;
-  pfds[1].fd = fd2;
-
-  pfds[0].events= pfds[1].events = POLLIN;
-
-  int nsocks = 1 + static_cast<int>(fd2 >= 0); // fd2 can optionally be -1
-
-  int ret{};
-  if (seconds >= 0) {
-    ret = poll(pfds.data(), nsocks, seconds * 1000 + mseconds);
-  }
-  else {
-    ret = poll(pfds.data(), nsocks, -1);
-  }
-  if (ret <= 0) {
-    return ret;
-  }
-
-  if ((pfds[0].revents & POLLIN) != 0 && (pfds[1].revents & POLLIN) == 0) {
-    *fdPtr = pfds[0].fd;
-  }
-  else if ((pfds[1].revents & POLLIN) != 0 && (pfds[0].revents & POLLIN) == 0) {
-    *fdPtr = pfds[1].fd;
-  }
-  else if(ret == 2) {
-    *fdPtr = pfds.at(dns_random_uint32() % 2).fd;
-  }
-  else {
-    *fdPtr = -1; // should never happen
-  }
-
-  return 1;
-}
-
-
 string humanDuration(time_t passed)
 {
   ostringstream ret;
index 7752b5f26ff3e327dd728d488f46c16118c668d9..390bc943baf703126b649dc0377f611e1ca07506 100644 (file)
@@ -108,7 +108,6 @@ std::string getCarbonHostName();
 string urlEncode(const string &text);
 int waitForData(int fileDesc, int seconds, int mseconds = 0);
 int waitForData(int fileDesc, struct timeval timeout);
-int waitFor2Data(int fd1, int fd2, int seconds, int mseconds, int* fd);
 int waitForMultiData(const set<int>& fds, const int seconds, const int mseconds, int* fd);
 int waitForRWData(int fileDesc, bool waitForRead, int seconds, int mseconds, bool* error = nullptr, bool* disconnected = nullptr);
 int waitForRWData(int fileDesc, bool waitForRead, struct timeval timeout, bool* error = nullptr, bool* disconnected = nullptr);