Updated Branches: refs/heads/3.3.x bc1b9d351 -> f591c2365
TS-1067 Remove the bandwidth management APIs, it is never used Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/959235e9 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/959235e9 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/959235e9 Branch: refs/heads/3.3.x Commit: 959235e94dcb67201ed0a2ec24d2e3a4631b3471 Parents: 52e3fd8 Author: Leif Hedstrom <zw...@apache.org> Authored: Tue Mar 26 08:29:59 2013 -0600 Committer: Leif Hedstrom <zw...@apache.org> Committed: Mon Apr 15 14:45:42 2013 -0600 ---------------------------------------------------------------------- iocore/net/I_UDPNet.h | 9 --- iocore/net/P_UDPConnection.h | 1 - iocore/net/P_UDPNet.h | 3 - iocore/net/UnixUDPNet.cc | 104 +------------------------------------ proxy/UglyLogStubs.cc | 3 - 5 files changed, 1 insertions(+), 119 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/959235e9/iocore/net/I_UDPNet.h ---------------------------------------------------------------------- diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h index 5e558ec..d9dc38b 100644 --- a/iocore/net/I_UDPNet.h +++ b/iocore/net/I_UDPNet.h @@ -120,15 +120,6 @@ public: Action *recvfrom_re(Continuation * c, void *token, int fd, sockaddr *fromaddr, socklen_t *fromaddrlen, IOBufferBlock * buf, int len, bool useReadCont = true, int timeout = 0); - // Continuation is really a UDPConnection; due to the include mess, we stick in the - // base-class of UDPConnection. - bool AllocBandwidth(Continuation * udpConn, double desiredMbps); - bool ChangeBandwidth(Continuation * udpConn, double desiredMbps); - void FreeBandwidth(Continuation * udpConn); - double GetAvailableBandwidth(); - - virtual void UDPNetProcessor_is_abstract() = 0; - }; inkcoreapi extern UDPNetProcessor & udpNet; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/959235e9/iocore/net/P_UDPConnection.h ---------------------------------------------------------------------- diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h index e1b5186..6c1c40d 100644 --- a/iocore/net/P_UDPConnection.h +++ b/iocore/net/P_UDPConnection.h @@ -100,7 +100,6 @@ UDPConnectionInternal::~UDPConnectionInternal() // TODO: This is not necessary, and should be removed with the // elimination of UDP bandwidth limiting (used by long since // removed UDP protocols). See bug TS-1067. - // udpNet.FreeBandwidth(this); continuation = NULL; mutex = NULL; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/959235e9/iocore/net/P_UDPNet.h ---------------------------------------------------------------------- diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h index 403152d..8a3cfb8 100644 --- a/iocore/net/P_UDPNet.h +++ b/iocore/net/P_UDPNet.h @@ -52,9 +52,6 @@ struct UDPNetProcessorInternal : public UDPNetProcessor off_t pollCont_offset; off_t udpNetHandler_offset; - -public: - virtual void UDPNetProcessor_is_abstract() { } }; extern UDPNetProcessorInternal udpNetInternal; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/959235e9/iocore/net/UnixUDPNet.cc ---------------------------------------------------------------------- diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc index c939f0f..73dc0f6 100644 --- a/iocore/net/UnixUDPNet.cc +++ b/iocore/net/UnixUDPNet.cc @@ -682,112 +682,10 @@ Lerror: return ACTION_IO_ERROR; } -bool -UDPNetProcessor::AllocBandwidth(Continuation * udpConn, double desiredMbps) -{ - UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn; - int64_t desiredbps = (int64_t) (desiredMbps * 1024.0 * 1024.0); - - if (G_inkPipeInfo.numPipes == 0) { - udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; - return true; - } - - if ((udpIntConn->pipe_class == 0) || - (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc + desiredbps > - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit)) { - Debug("udpnet-admit", "Denying flow with %lf Mbps", desiredMbps); - return false; - } - udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; - udpIntConn->allocedbps = desiredbps; - ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, desiredbps); - Debug("udpnet-admit", "Admitting flow with %lf Mbps (a=%" PRId64 ", lim=%" PRId64 ")", - desiredMbps, - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit); - return true; -} - -bool -UDPNetProcessor::ChangeBandwidth(Continuation * udpConn, double desiredMbps) -{ - UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn; - int64_t desiredbps = (int64_t) (desiredMbps * 1024.0 * 1024.0); - int64_t oldbps = (int64_t) (udpIntConn->flowRateBps * 8.0); - - if (G_inkPipeInfo.numPipes == 0) { - udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; - return true; - } - // arithmetic here is in bits-per-sec. - if ((udpIntConn->pipe_class == 0) || - (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc + - desiredbps - oldbps) > G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit) { - Debug("udpnet-admit", "Unable to change b/w for flow to %lf Mbps", desiredMbps); - return false; - } - udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; - udpIntConn->allocedbps = desiredbps; - ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, desiredbps - oldbps); - Debug("udpnet-admit", "Changing flow's b/w from %lf Mbps to %lf Mbps (a=%" PRId64 ", lim=%" PRId64 ")", - (double) oldbps / (1024.0 * 1024.0), - desiredMbps, - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwLimit); - return true; -} - -void -UDPNetProcessor::FreeBandwidth(Continuation * udpConn) -{ - UDPConnectionInternal *udpIntConn = (UDPConnectionInternal *) udpConn; - int64_t bps; - - if (G_inkPipeInfo.numPipes == 0) - return; - - Debug("udpnet-free", "Trying to releasing %lf (%" PRId64 ") Kbps", udpIntConn->flowRateBps, udpIntConn->allocedbps); - - bps = udpIntConn->allocedbps; - if (bps <= 0) - return; - - ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, -bps); - - Debug("udpnet-free", "Releasing %lf Kbps", bps / 1024.0); - - if (G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc < 0) - G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc = 0; - - udpIntConn->flowRateBps = 0.0; - udpIntConn->allocedbps = 0; -} - -double -UDPNetProcessor::GetAvailableBandwidth() -{ - int i; - double usedBw = 0.0; - - if (G_inkPipeInfo.numPipes == 0) - // return 100Mbps if there are no pipes - return 100.0; - - for (i = 0; i < G_inkPipeInfo.numPipes + 1; i++) { - usedBw += G_inkPipeInfo.perPipeInfo[i].bwUsed; - } - return G_inkPipeInfo.interfaceMbps - usedBw; -} // send out all packets that need to be sent out as of time=now UDPQueue::UDPQueue() -: last_report(0) -, last_service(0) -, last_byteperiod(0) -, bytesSent(0) -, packets(0) -, added(0) + : last_report(0), last_service(0), last_byteperiod(0), bytesSent(0), packets(0), added(0) { } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/959235e9/proxy/UglyLogStubs.cc ---------------------------------------------------------------------- diff --git a/proxy/UglyLogStubs.cc b/proxy/UglyLogStubs.cc index b68bf97..0456e2b 100644 --- a/proxy/UglyLogStubs.cc +++ b/proxy/UglyLogStubs.cc @@ -44,9 +44,6 @@ class FakeUDPNetProcessor : public UDPNetProcessor { ink_release_assert(false); return 0; }; - virtual void UDPNetProcessor_is_abstract() { - ink_release_assert(false); - }; } fakeUDPNet; UDPNetProcessor& udpNet = fakeUDPNet;