You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/04/02 23:36:19 UTC
[02/15] git commit: TS-1067 Remove a number of unused member variables
TS-1067 Remove a number of unused member variables
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/02bd9a7e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/02bd9a7e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/02bd9a7e
Branch: refs/heads/master
Commit: 02bd9a7e7337a61236c87f26ac908e0711133e23
Parents: 7779ba6
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 20:24:45 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600
----------------------------------------------------------------------
iocore/net/I_UDPPacket.h | 1 -
iocore/net/P_UDPNet.h | 48 +++++++++++++++++++---------------------
iocore/net/P_UDPPacket.h | 23 +------------------
iocore/net/UnixUDPNet.cc | 34 +++++-----------------------
4 files changed, 30 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/I_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_UDPPacket.h b/iocore/net/I_UDPPacket.h
index ec50b9e..09826dc 100644
--- a/iocore/net/I_UDPPacket.h
+++ b/iocore/net/I_UDPPacket.h
@@ -55,7 +55,6 @@ public:
UDPConnection *getConnection();
void setArrivalTime(ink_hrtime t);
IOBufferBlock *getIOBlockChain();
- void setReliabilityPkt();
int64_t getPktLength();
/**
Add IOBufferBlock (chain) to end of packet.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index bf0d67d..9c564f3 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -63,7 +63,7 @@ class UDPQueue
public:
void service(UDPNetHandler *);
- // In the absence of bulk-io, we are down sending packet after packet
+
void SendPackets();
void SendUDPPacket(UDPPacketInternal * p, int32_t pktLen);
@@ -74,7 +74,6 @@ public:
InkAtomicList atomicQueue;
ink_hrtime last_report;
ink_hrtime last_service;
- ink_hrtime last_byteperiod;
int packets;
int added;
@@ -89,24 +88,20 @@ public:
#define SLOT_TIME HRTIME_MSECONDS(SLOT_TIME_MSEC)
#define N_SLOTS 2048
-extern uint64_t g_udp_bytesPending;
-
class PacketQueue
{
public:
PacketQueue()
- :nPackets(0)
- , now_slot(0)
+ : nPackets(0), now_slot(0)
{
lastPullLongTermQ = 0;
init();
}
virtual ~ PacketQueue()
- {
- }
- int nPackets;
+ { }
+ int nPackets;
ink_hrtime lastPullLongTermQ;
Queue<UDPPacketInternal> longTermQ;
Queue<UDPPacketInternal> bucket[N_SLOTS];
@@ -126,12 +121,12 @@ public:
}
}
- void addPacket(UDPPacketInternal * e, ink_hrtime now = 0) {
+ void addPacket(UDPPacketInternal * e, ink_hrtime now = 0)
+ {
int before = 0;
int slot;
if (IsCancelledPacket(e)) {
- g_udp_bytesPending -= e->getPktLength();
e->free();
return;
}
@@ -168,7 +163,8 @@ public:
e->in_the_priority_queue = 1;
e->in_heap = slot;
bucket[slot].enqueue(e);
- };
+ }
+
UDPPacketInternal *firstPacket(ink_hrtime t)
{
if (t > delivery_time[now_slot]) {
@@ -176,23 +172,25 @@ public:
} else {
return NULL;
}
- };
+ }
+
UDPPacketInternal *getFirstPacket()
{
nPackets--;
return dequeue_ready(0);
- };
+ }
+
int size()
{
ink_assert(nPackets >= 0);
return nPackets;
- };
+ }
bool IsCancelledPacket(UDPPacketInternal * p)
{
// discard packets that'll never get sent...
return ((p->conn->shouldDestroy()) || (p->conn->GetSendGenerationNumber() != p->reqGenerationNum));
- };
+ }
void FreeCancelledPackets(int numSlots)
{
@@ -204,7 +202,6 @@ public:
s = (now_slot + i) % N_SLOTS;
while (NULL != (p = bucket[s].dequeue())) {
if (IsCancelledPacket(p)) {
- g_udp_bytesPending -= p->getPktLength();
p->free();
continue;
}
@@ -215,7 +212,7 @@ public:
bucket[s].enqueue(p);
}
}
- };
+ }
void advanceNow(ink_hrtime t)
{
@@ -254,7 +251,8 @@ public:
Debug("udpnet-service", "Advancing by (%d slots): behind by %" PRId64 " ms",
s - now_slot, ink_hrtime_to_msec(t - delivery_time[now_slot]));
now_slot = s;
- };
+ }
+
private:
void remove(UDPPacketInternal * e)
{
@@ -265,7 +263,8 @@ private:
}
public:
- UDPPacketInternal * dequeue_ready(ink_hrtime t) {
+ UDPPacketInternal *dequeue_ready(ink_hrtime t)
+ {
(void) t;
UDPPacketInternal *e = bucket[now_slot].dequeue();
if (e) {
@@ -295,8 +294,7 @@ public:
private:
void kill_cancelled_events()
- {
- }
+ { }
};
#endif
@@ -331,17 +329,17 @@ struct PollCont;
static inline PollCont *
get_UDPPollCont(EThread * t)
{
- return (PollCont *) ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
+ return (PollCont *)ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
}
static inline UDPNetHandler *
get_UDPNetHandler(EThread * t)
{
- return (UDPNetHandler *)
- ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
+ return (UDPNetHandler *)ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
}
// All of this stuff is for UDP egress b/w management
+// ToDo: It'd be nice to eliminate this entirely.... But we have no working use of UDPNet afaik. /leif
extern PacketQueue G_inkPipeInfo;
#endif //__P_UDPNET_H_
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/P_UDPPacket.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index 0a0d1a8..a93f083 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -45,7 +45,6 @@ public:
UDPPacketInternal();
virtual ~ UDPPacketInternal();
- void append_bytes(char *buf, int len);
void append_block_internal(IOBufferBlock * block);
virtual void free();
@@ -56,8 +55,6 @@ public:
uint64_t pktSendFinishTime;
uint64_t pktLength;
- bool isReliabilityPkt;
-
int reqGenerationNum;
ink_hrtime delivery_time; // when to deliver packet
ink_hrtime arrival_time; // when packet arrived
@@ -78,7 +75,7 @@ inkcoreapi extern ClassAllocator<UDPPacketInternal> udpPacketAllocator;
TS_INLINE
UDPPacketInternal::UDPPacketInternal()
- : pktSendStartTime(0), pktSendFinishTime(0), pktLength(0), isReliabilityPkt(false),
+ : pktSendStartTime(0), pktSendFinishTime(0), pktLength(0),
reqGenerationNum(0), delivery_time(0), arrival_time(0), cont(NULL) , conn(NULL)
#if defined(PACKETQUEUE_IMPL_AS_PQLIST) || defined(PACKETQUEUE_IMPL_AS_RING)
,in_the_priority_queue(0), in_heap(0)
@@ -106,24 +103,6 @@ UDPPacketInternal::free()
}
TS_INLINE void
-UDPPacketInternal::append_bytes(char *buf, int len)
-{
- IOBufferData *d = NULL;
- if (buf) {
- d = new_xmalloc_IOBufferData(buf, len);
- append_block(new_IOBufferBlock(d, len));
- }
-}
-
-TS_INLINE void
-UDPPacket::setReliabilityPkt()
-{
- UDPPacketInternal *p = (UDPPacketInternal *) this;
-
- p->isReliabilityPkt = true;
-}
-
-TS_INLINE void
UDPPacket::append_block(IOBufferBlock * block)
{
UDPPacketInternal *p = (UDPPacketInternal *) this;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02bd9a7e/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c1e839d..a20c93f 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -48,7 +48,6 @@ EventType ET_UDP;
UDPNetProcessorInternal udpNetInternal;
UDPNetProcessor &udpNet = udpNetInternal;
-uint64_t g_udp_bytesPending;
int32_t g_udp_periodicCleanupSlots;
int32_t g_udp_periodicFreeCancelledPkts;
int32_t g_udp_numSendRetries;
@@ -630,7 +629,7 @@ Lerror:
// 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), packets(0), added(0)
+ : last_report(0), last_service(0), packets(0), added(0)
{
}
@@ -682,10 +681,6 @@ UDPQueue::service(UDPNetHandler * nh)
p = stk.pop();
ink_assert(p->link.prev == NULL);
ink_assert(p->link.next == NULL);
- if (p->isReliabilityPkt) {
- reliabilityPktQueue.enqueue(p);
- continue;
- }
// insert into our queue.
Debug("udp-send", "Adding %p", p);
pktLen = p->getPktLength();
@@ -700,13 +695,11 @@ UDPQueue::service(UDPNetHandler * nh)
p->conn->lastPktStartTime = p->pktSendStartTime;
p->delivery_time = p->pktSendStartTime;
- g_udp_bytesPending += pktLen;
G_inkPipeInfo.addPacket(p, now);
}
}
if ((now - lastPrintTime) > ink_hrtime_from_sec(30)) {
- Debug("udp-pending-packets", "udp bytes pending: %" PRId64 "", g_udp_bytesPending);
Debug("udp-sched-jitter", "avg. udp sched jitter: %f", (double) schedJitter / numTimesSched);
schedJitter = 0;
numTimesSched = 0;
@@ -731,8 +724,6 @@ UDPQueue::SendPackets()
UDPPacketInternal *p;
static ink_hrtime lastCleanupTime = ink_get_hrtime_internal();
ink_hrtime now = ink_get_hrtime_internal();
- // ink_hrtime send_threshold_time = now + HRTIME_MSECONDS(5);
- // send packets for SLOT_TIME per attempt
ink_hrtime send_threshold_time = now + SLOT_TIME;
int32_t bytesThisSlot = INT_MAX, bytesUsed = 0;
int32_t bytesThisPipe, sentOne;
@@ -744,9 +735,6 @@ UDPQueue::SendPackets()
while ((p = reliabilityPktQueue.dequeue()) != NULL) {
pktLen = p->getPktLength();
- g_udp_bytesPending -= pktLen;
- p->conn->nBytesDone += pktLen;
-
if (p->conn->shouldDestroy())
goto next_pkt_3;
if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
@@ -770,7 +758,6 @@ sendPackets:
while ((bytesThisPipe > 0) && (G_inkPipeInfo.firstPacket(send_threshold_time))) {
p = G_inkPipeInfo.getFirstPacket();
pktLen = p->getPktLength();
- g_udp_bytesPending -= pktLen;
if (p->conn->shouldDestroy())
goto next_pkt;
@@ -790,7 +777,7 @@ sendPackets:
bytesThisSlot -= bytesUsed;
- if ((bytesThisSlot > 0) && (sentOne)) {
+ if ((bytesThisSlot > 0) && sentOne) {
// redistribute the slack...
now = ink_get_hrtime_internal();
if (G_inkPipeInfo.firstPacket(now) == NULL) {
@@ -799,15 +786,8 @@ sendPackets:
goto sendPackets;
}
- if ((g_udp_periodicFreeCancelledPkts) &&
- (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
- uint64_t nbytes = g_udp_bytesPending;
- ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
-
+ if ((g_udp_periodicFreeCancelledPkts) && (now - lastCleanupTime > ink_hrtime_from_sec(g_udp_periodicFreeCancelledPkts))) {
G_inkPipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
- endTime = ink_get_hrtime_internal();
- Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
- g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));
lastCleanupTime = now;
}
}
@@ -821,11 +801,9 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
int real_len = 0;
int n, count, iov_len = 0;
- if (!p->isReliabilityPkt) {
- p->conn->lastSentPktStartTime = p->delivery_time;
- }
-
+ p->conn->lastSentPktStartTime = p->delivery_time;
Debug("udp-send", "Sending %p", p);
+
#if !defined(solaris)
msg.msg_control = 0;
msg.msg_controllen = 0;
@@ -852,7 +830,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
// send succeeded or some random error happened.
break;
if (errno == EAGAIN) {
- count++;
+ ++count;
if ((g_udp_numSendRetries > 0) && (count >= g_udp_numSendRetries)) {
// tried too many times; give up
Debug("udpnet", "Send failed: too many retries");