Encapsulate UdpSlot::m_resendTime & UdpSlot::m_resendCount

This commit is contained in:
Ai Lin Chia
2016-08-04 15:54:37 +02:00
parent 12e3718fa6
commit bffc849a59
3 changed files with 15 additions and 7 deletions

@ -527,7 +527,7 @@ void printUdpTable ( SafeBuf *p, const char *title, UdpServer *server ,
const char *rf1 = "";
const char *rf2 = "";
if ( s->m_resendCount ) {
if ( s->getResendCount() ) {
rf1 = "<b style=color:red;>";
rf2 = "</b>";
}
@ -551,7 +551,7 @@ void printUdpTable ( SafeBuf *p, const char *title, UdpServer *server ,
s->getDatagramsToSend() ,
s->getNumAcksRead() ,
rf1 ,
s->m_resendCount ,
s->getResendCount() ,
rf2
);
}

@ -2091,7 +2091,7 @@ bool UdpServer::readTimeoutPoll ( int64_t now ) {
(uint16_t) slot->getPort(),
(int32_t) slot->isDoneReading(),
slot->getDatagramsToSend(),
slot->m_resendTime,
slot->getResendTime(),
(uint64_t) slot->getLastReadTime(),
(uint64_t) (now - slot->getLastReadTime()),
(uint64_t) slot->getLastSendTime(),
@ -2153,11 +2153,11 @@ bool UdpServer::readTimeoutPoll ( int64_t now ) {
// clock on us, so it won't hurt to resend just to update
// otherwise, we could be waiting years to resend
if ( delta < 0 ) {
delta = slot->m_resendTime;
delta = slot->getResendTime();
}
// continue if we just sent something
if ( delta < slot->m_resendTime ) {
if ( delta < slot->getResendTime() ) {
continue;
}
@ -2243,7 +2243,7 @@ bool UdpServer::readTimeoutPoll ( int64_t now ) {
// check it
if ( slot->m_maxResends >= 0 &&
// if maxResends it 0, do not do ANY resend! just err out.
slot->m_resendCount >= slot->m_maxResends &&
slot->getResendCount() >= slot->m_maxResends &&
// did not get all acks
slot->m_sentBitsOn > slot->m_readAckBitsOn &&
// fix too many timing out slot msgs when a host is
@ -2265,7 +2265,7 @@ bool UdpServer::readTimeoutPoll ( int64_t now ) {
"after %" PRId32" resends. hostid=%" PRId32" "
"(elapsed=%" PRId64")" ,
(int32_t)slot->getMsgType(),
(int32_t)slot->m_resendCount ,
(int32_t)slot->getResendCount() ,
slot->getHostId(),elapsed);
// keep going
continue;

@ -105,6 +105,14 @@ public:
return m_hostId;
}
int32_t getResendTime() const {
return m_resendTime;
}
char getResendCount() const {
return m_resendCount;
}
int32_t getErrno() const {
return m_errno;
}