Make MsgC/Msge1 coorperation more clear

This commit is contained in:
Ivan Skytte Jørgensen 2016-11-24 15:33:07 +01:00
parent 25d0df06b9
commit ccd211261b
3 changed files with 13 additions and 11 deletions

@ -14,8 +14,8 @@ MsgC::MsgC ( ) {
memset(m_request, 0, sizeof(m_request));
m_ipPtr = NULL;
m_callback = NULL;
m_state2 = NULL;
m_state3 = NULL;
m_msge1 = NULL;
m_msge1State = 0;
}
MsgC::~MsgC ( ) {

8
MsgC.h

@ -19,6 +19,8 @@ returned result (the IP address) should be stored in all 4 caches.*/
#include "Multicast.h"
#include "Url.h"
class Msge1;
class MsgC {
public:
@ -41,9 +43,9 @@ class MsgC {
void (*m_callback) (void *state ,int32_t ip);
// used by MsgE to store its data
void *m_state2;
void *m_state3;
// used by Msge1 to store a pointer to itself
Msge1 *m_msge1;
int32_t m_msge1State;
// private:
Multicast m_mcast;

@ -248,8 +248,8 @@ bool Msge1::sendMsgC ( int32_t i , const char *host , int32_t hlen ) {
// using the the ith msgC
MsgC *m = &m_msgCs[i];
// save i and this in the msgC itself
m->m_state2 = this;
m->m_state3 = (void *)(PTRTYPE)i;
m->m_msge1 = this;
m->m_msge1State = i;
if (!m->getIp(host, hlen, &m_ipBuf[n], m, gotMsgCWrapper)) {
return false;
@ -259,8 +259,8 @@ bool Msge1::sendMsgC ( int32_t i , const char *host , int32_t hlen ) {
void Msge1::gotMsgCWrapper(void *state, int32_t ip) {
MsgC *m = (MsgC *)state;
Msge1 *THIS = (Msge1 *)m->m_state2;
int32_t i = (int32_t )(PTRTYPE)m->m_state3;
Msge1 *THIS = m->m_msge1;
int32_t i = m->m_msge1State;
if ( ! THIS->doneSending ( i ) ) return;
// try to launch more, returns false if not done
if ( ! THIS->launchRequests(i) ) return;
@ -295,8 +295,8 @@ bool Msge1::addTag ( int32_t i ) {
// using the the ith msgC
MsgC *m = &m_msgCs[i];
// save i and this in the msgC itself
m->m_state2 = this;
m->m_state3 = (void *)(PTRTYPE)i;
m->m_msge1 = this;
m->m_msge1State = i;
// store the domain here
//char *domBuf = m->m_request;
// get the domain