Remove unused/always same value replyBuf, replyBufMaxSize, rdbId from Multicast::send

This commit is contained in:
Ai Lin Chia
2016-08-03 14:33:08 +02:00
parent b0a460fecd
commit 207c379caa
6 changed files with 15 additions and 59 deletions

@ -326,8 +326,6 @@ skip:
KEY1(m_startKey,m_ks),KEY0(m_startKey),
(int32_t)m_niceness);
char *replyBuf = NULL;
int32_t replyBufMaxSize = 0;
bool freeReply = true;
// . make a request with the info above (note: not in network order)
@ -384,8 +382,8 @@ skip:
timeout ,
-1 , // backoff
-1 , // maxwait
replyBuf ,
replyBufMaxSize ,
NULL ,
0 ,
m_niceness ) ) { // cback niceness
logTrace( g_conf.m_logTraceMsg0, "END, return true. Request sent" );
return true;
@ -416,9 +414,6 @@ skip:
//for ( int32_t i = 0; i < m_numSplit; i++ ) {
QUICKPOLL(m_niceness);
//int32_t gr;
char *buf;
buf = replyBuf;
// get the multicast
Multicast *m = &m_mcast;
@ -437,10 +432,7 @@ skip:
timeout*1000 , // timeout
niceness ,
firstHostId ,
buf ,
replyBufMaxSize ,
freeReply , // free reply buf?
rdbId ) )
freeReply ) ) // free reply buf?
{
log(LOG_ERROR, "net: Failed to send request for data from %s in shard "
"#%" PRIu32" over network: %s.",

@ -226,8 +226,6 @@ bool Msg20::getSummary ( Msg20Request *req ) {
timeout , // timeout
req->m_niceness ,
firstHostId , // first hostid
NULL , // reply buffer
0 , // reply buffer size
false )) { // free reply buf?
// sendto() sometimes returns "Network is down" so i guess
// we just had an "error reply".

@ -171,10 +171,7 @@ bool Msg22::getTitleRec ( Msg22Request *r ,
timeout*1000 , // timeout
r->m_niceness , // nice, reply size can be huge
firstHostId , // first hostid
NULL , // replyBuf
0 , // replyBufMaxSize
false , // free reply buf?
RDB_TITLEDB ) ){ // rdbId of titledb
false ) ){ // free reply buf?
log("db: Requesting title record had error: %s.",
mstrerror(g_errno) );
// set m_errno

@ -178,8 +178,6 @@ bool MsgC::getIp(const char *hostname, int32_t hostnameLen, int32_t *ip, void *s
timeout , // timeout
niceness , // niceness
firstHostId,// first host to try
NULL , // reply buf
0 , // replybuf max size
false )) { // free reply buf?
//did not block, error
log(LOG_DEBUG,"dns: msgc: mcast had error: %s",

@ -82,10 +82,7 @@ bool Multicast::send ( char *msg ,
int64_t totalTimeout , // in millseconds
int32_t niceness ,
int32_t firstHostId ,
char *replyBuf ,
int32_t replyBufMaxSize ,
bool freeReplyBuf ,
char rdbId ) {
bool freeReplyBuf ) {
bool sendToSelf = true;
// make sure not being re-used!
@ -113,8 +110,8 @@ bool Multicast::send ( char *msg ,
m_niceness = niceness;
// this can't be -1 i guess
if ( totalTimeout <= 0 ) { g_process.shutdownAbort(true); }
m_replyBuf = replyBuf;
m_replyBufMaxSize = replyBufMaxSize;
m_replyBuf = NULL;
m_replyBufMaxSize = 0;
m_startTime = gettimeofdayInMilliseconds();
m_numReplies = 0;
m_readBuf = NULL;
@ -125,7 +122,7 @@ bool Multicast::send ( char *msg ,
m_sentToTwin = false;
m_retryCount = 0;
m_key = key;
m_rdbId = rdbId;
// clear m_retired, m_errnos, m_slots
memset ( m_retired , 0 , sizeof(bool ) * MAX_HOSTS_PER_GROUP );
memset ( m_errnos , 0 , sizeof(int32_t ) * MAX_HOSTS_PER_GROUP );
@ -574,30 +571,6 @@ int32_t Multicast::pickBestHost ( uint32_t key , int32_t firstHostId ) {
//return i;
}
// . pick the fastest host from m_hosts based on avg roundtrip time for ACKs
// . skip hosts in our m_retired[] list of hostIds
// . returns -1 if none left to pick
/*
int32_t Multicast::pickBestHost ( ) {
int32_t mini = -1;
int32_t minPing = 0x7fffffff;
// TODO: reset the sublist ptr????
// cast the msg to "hostsPerGroup" hosts in group "groupId"
for ( int32_t i = 0 ; i < m_numHosts ; i++ ) {
// skip host if we've retired it
if ( m_retired[i] ) continue;
// get the host
Host *h = &m_hosts[i];
// see if we got a new fastest host, continue if not
if ( h->m_pingAvg > minPing ) continue;
minPing = h->m_pingAvg;
mini = i;
}
// return our candidate, may be -1 if all were picked before
return mini;
}
*/
// . returns false and sets error on g_errno
// . returns true if kicked of the request (m_msg)
// . sends m_msg to host "h"
@ -1109,7 +1082,9 @@ void Multicast::closeUpShop ( UdpSlot *slot ) {
// . this happens if the udp server is hot (async signal based) and
// m_replyBuf is NULL because he cannot malloc a buf to read into
// because malloc is not async signal safe
if ( slot->m_tmpBuf == slot->m_readBuf ) m_freeReadBuf = false;
if ( slot->m_tmpBuf == slot->m_readBuf ) {
m_freeReadBuf = false;
}
// don't let UdpServer free the readBuf now that we point to it
slot->m_readBuf = NULL;
@ -1168,7 +1143,9 @@ void Multicast::destroySlotsInProgress ( UdpSlot *slot ) {
char *Multicast::getBestReply(int32_t *replySize, int32_t *replyMaxSize, bool *freeReply, bool steal) {
*replySize = m_readBufSize;
*replyMaxSize = m_readBufMaxSize;
if(steal) m_freeReadBuf = false;
if(steal) {
m_freeReadBuf = false;
}
*freeReply = m_freeReadBuf;
// this can be NULL if we destroyed the slot in progress only to
// try another host who was dead!

@ -87,10 +87,7 @@ class Multicast {
int64_t totalTimeout , //relative timeout in milliseconds
int32_t niceness ,
int32_t firstHostId = -1 ,// first host to try
char *replyBuf = NULL ,
int32_t replyBufMaxSize = 0 ,
bool freeReplyBuf = true ,
char rdbId = 0 ); // bogus rdbId
bool freeReplyBuf = true );
// . get the reply from your NON groupSend
// . if *freeReply is true then you are responsible for freeing this
@ -182,9 +179,6 @@ class Multicast {
int32_t m_key;
//bool m_doDiskLoadBalancing;
char m_rdbId ;
// Msg1 might be able to add data to our tree to save a net trans.
bool m_sendToSelf;