virtual void main() { running = true; loop { INode *senderNode; CMessageBuffer msg; if (!queryWorldCommunicator().recv(msg, NULL, MPTAG_THORREGISTRATION, &senderNode)) return; rank_t sender = queryClusterGroup().rank(senderNode); SocketEndpoint ep = senderNode->endpoint(); ep.port -= THOR_MP_INC; StringBuffer url; ep.getUrlStr(url); if (RANK_NULL == sender) { PROGLOG("Node %s trying to deregister is not part of this cluster", url.str()); continue; } RegistryCode code; msg.read((int &)code); if (!rc_deregister == code) throwUnexpected(); registry.deregisterNode(sender); } running = false; }
StringBuffer &errorMessage(StringBuffer &str) const { if (!origin.length() || 0 != stricmp("user", origin.get())) // don't report slave in user message { if (graphId) str.append("Graph[").append(graphId).append("], "); if (kind) str.append(activityKindStr(kind)); if (id) { if (kind) str.append('['); str.append(id); if (kind) str.append(']'); str.append(": "); } if (node) { str.appendf("SLAVE #%d [", node); queryClusterGroup().queryNode(node).endpoint().getUrlStr(str); str.append("]: "); } } str.append(msg); return str; }
StringBuffer &errorMessage(StringBuffer &str) const { if (!origin.length() || 0 != stricmp("user", origin.get())) // don't report slave in user message { if (graphId) str.append("Graph ").append(graphName).append("[").append(graphId).append("], "); if (kind) str.append(activityKindStr(kind)); if (id) { if (kind) str.append('['); str.append(id); if (kind) str.append(']'); str.append(": "); } if (slave) { str.appendf("SLAVE #%d [", slave); queryClusterGroup().queryNode(slave).endpoint().getUrlStr(str); str.append("]: "); } } str.append(msg); if (originalException) { if (msg.length()) str.append(" - "); str.append("caused by ("); str.append(originalException->errorCode()); str.append(", "); originalException->errorMessage(str); str.append(")"); } return str; }
CGraphProgressHandler() : threaded("CGraphProgressHandler") { self = queryMyNode()->endpoint(); stopped = true; StringBuffer ipStr; queryClusterGroup().queryNode(0).endpoint().getIpText(ipStr); sock.setown(ISocket::udp_connect(getFixedPort(getMasterPortBase(), TPORT_watchdog),ipStr.str())); progressEnabled = globals->getPropBool("@watchdogProgressEnabled"); sendData(); // send initial data stopped = false; #ifdef _WIN32 threaded.adjustPriority(+1); // it is critical that watchdog packets get through. #endif threaded.init(this); }