This is an automated email from the ASF dual-hosted git repository. scw00 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 0ec8ca4 Cleanup: Remove useless UDPConnection function 0ec8ca4 is described below commit 0ec8ca4baa933fb0484e7767a0864fb5522b6734 Author: scw00 <sc...@apache.org> AuthorDate: Tue Nov 19 09:18:53 2019 +0800 Cleanup: Remove useless UDPConnection function --- iocore/net/I_UDPConnection.h | 4 +--- iocore/net/P_UDPConnection.h | 50 +++++++++------------------------------- iocore/net/P_UnixUDPConnection.h | 3 +-- 3 files changed, 13 insertions(+), 44 deletions(-) diff --git a/iocore/net/I_UDPConnection.h b/iocore/net/I_UDPConnection.h index d06920f..4a17973 100644 --- a/iocore/net/I_UDPConnection.h +++ b/iocore/net/I_UDPConnection.h @@ -49,7 +49,7 @@ public: SOCKET getFd(); void setBinding(struct sockaddr const *); void setBinding(const IpAddr &, in_port_t); - inkcoreapi int getBinding(struct sockaddr *); + inkcoreapi bool getBinding(struct sockaddr *); void destroy(); int shouldDestroy(); @@ -86,8 +86,6 @@ public: int getPortNum(); int GetSendGenerationNumber(); // const - void SetLastSentPktTSSeqNum(int64_t sentSeqNum); - int64_t cancel(); void setContinuation(Continuation *c); /** diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h index ef69b31..10e57c2 100644 --- a/iocore/net/P_UDPConnection.h +++ b/iocore/net/P_UDPConnection.h @@ -35,19 +35,17 @@ class UDPConnectionInternal : public UDPConnection { public: - UDPConnectionInternal(); + UDPConnectionInternal() = default; ~UDPConnectionInternal() override; Continuation *continuation = nullptr; - int recvActive = 0; // interested in receiving int refcount = 0; // public for assertion - SOCKET fd; - IpEndpoint binding; - int binding_valid = 0; - int tobedestroyed = 0; - int sendGenerationNum; - int64_t lastSentPktTSSeqNum; + SOCKET fd = -1; + IpEndpoint binding{}; + bool binding_valid = false; + int tobedestroyed = 0; + int sendGenerationNum = 0; // this is for doing packet scheduling: we keep two values so that we can // implement cancel. The first value tracks the startTime of the last @@ -55,21 +53,11 @@ public: // startTime of the last packet when we are doing scheduling; whenever the // associated continuation cancels a packet, we rest lastPktStartTime to be // the same as the lastSentPktStartTime. - uint64_t lastSentPktStartTime; - uint64_t lastPktStartTime; + uint64_t lastSentPktStartTime = 0; + uint64_t lastPktStartTime = 0; }; TS_INLINE -UDPConnectionInternal::UDPConnectionInternal() : fd(-1) -{ - sendGenerationNum = 0; - lastSentPktTSSeqNum = -1; - lastSentPktStartTime = 0; - lastPktStartTime = 0; - memset(&binding, 0, sizeof binding); -} - -TS_INLINE UDPConnectionInternal::~UDPConnectionInternal() { continuation = nullptr; @@ -87,7 +75,7 @@ UDPConnection::setBinding(struct sockaddr const *s) { UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this); ats_ip_copy(&p->binding, s); - p->binding_valid = 1; + p->binding_valid = true; } TS_INLINE void @@ -97,10 +85,10 @@ UDPConnection::setBinding(IpAddr const &ip, in_port_t port) IpEndpoint addr; addr.assign(ip, htons(port)); ats_ip_copy(&p->binding, addr); - p->binding_valid = 1; + p->binding_valid = true; } -TS_INLINE int +TS_INLINE bool UDPConnection::getBinding(struct sockaddr *s) { UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this); @@ -144,22 +132,6 @@ UDPConnection::getPortNum() return ats_ip_port_host_order(&static_cast<UDPConnectionInternal *>(this)->binding); } -TS_INLINE int64_t -UDPConnection::cancel() -{ - UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this); - - p->sendGenerationNum++; - p->lastPktStartTime = p->lastSentPktStartTime; - return p->lastSentPktTSSeqNum; -} - -TS_INLINE void -UDPConnection::SetLastSentPktTSSeqNum(int64_t sentSeqNum) -{ - static_cast<UDPConnectionInternal *>(this)->lastSentPktTSSeqNum = sentSeqNum; -} - TS_INLINE void UDPConnection::setContinuation(Continuation *c) { diff --git a/iocore/net/P_UnixUDPConnection.h b/iocore/net/P_UnixUDPConnection.h index 9e3c2f2..37ad8bd 100644 --- a/iocore/net/P_UnixUDPConnection.h +++ b/iocore/net/P_UnixUDPConnection.h @@ -97,8 +97,7 @@ UDPConnection::recv(Continuation *c) // register callback interest. p->continuation = c; ink_assert(c != nullptr); - mutex = c->mutex; - p->recvActive = 1; + mutex = c->mutex; return ACTION_RESULT_NONE; }