Esempio n. 1
0
// . this is called when we got a local RdbList
// . we need to call it to call the original caller callback
void gotListWrapper2 ( void *state , RdbList *list , Msg5 *msg5 ) {
	logTrace( g_conf.m_logTraceMsg0, "BEGIN" );

	Msg0 *THIS = (Msg0 *) state;
	THIS->reset(); // delete m_msg5
	THIS->m_callback ( THIS->m_state );//, THIS->m_list );

	logTrace( g_conf.m_logTraceMsg0, "END. rdbId=%d", (int)THIS->m_rdbId );
}
Esempio n. 2
0
// . return false if you want this slot immediately nuked w/o replying to it
void gotSingleReplyWrapper ( void *state , UdpSlot *slot ) {
	Msg0 *THIS = (Msg0 *)state;
	if ( ! g_errno ) { 
		int32_t  replySize    = slot->m_readBufSize;
		int32_t  replyMaxSize = slot->m_readBufMaxSize;
		char *reply        = slot->m_readBuf;
		THIS->gotReply( reply , replySize , replyMaxSize );
		// don't let UdpServer free this since we own it now
		slot->m_readBuf = NULL;
	}
	// never let m_request (sendBuf) be freed
	slot->m_sendBufAlloc = NULL;
	// do the callback now
	THIS->m_callback ( THIS->m_state );// THIS->m_list );
}
Esempio n. 3
0
void gotMulticastReplyWrapper0 ( void *state , void *state2 ) {
	logTrace( g_conf.m_logTraceMsg0, "BEGIN" );

	Msg0 *THIS = (Msg0 *)state;

	if ( ! g_errno ) {
		int32_t  replySize;
		int32_t  replyMaxSize;
		bool  freeit;
		char *reply = THIS->m_mcast.getBestReply (&replySize,
							  &replyMaxSize,
							  &freeit);
		THIS->gotReply( reply , replySize , replyMaxSize ) ;
	}
	THIS->m_callback ( THIS->m_state );
	logTrace( g_conf.m_logTraceMsg0, "END" );
}
void gotMulticastReplyWrapper0 ( void *state , void *state2 ) {
	Msg0 *THIS = (Msg0 *)state;
//#ifdef SPLIT_INDEXDB
	//if ( g_hostdb.m_indexSplits > 1 ) {
	/*
	if ( THIS->m_numSplit > 1 ) {
		THIS->m_numReplies++;
		if ( ! g_errno ) {
			QUICKPOLL(THIS->m_niceness);
			// for split, wait for all replies
			if ( THIS->m_numReplies < THIS->m_numRequests )
				return;
			else {
				// got it all, call the reply
				// watch out for someone having an error
				if ( ! THIS->m_errno )
					THIS->gotSplitReply();
				else
					g_errno = THIS->m_errno;
			}
		}
		else {
			// got an error, set an error state and wait for all
			// replies
			THIS->m_errno = g_errno;
			if ( THIS->m_numReplies < THIS->m_numRequests )
				return;
		}
		THIS->m_callback ( THIS->m_state );//, THIS->m_list );
	}
//#else
	else {
	*/
	if ( ! g_errno ) {
		int32_t  replySize;
		int32_t  replyMaxSize;
		bool  freeit;
		char *reply = THIS->m_mcast.getBestReply (&replySize,
							  &replyMaxSize,
							  &freeit);
		THIS->gotReply( reply , replySize , replyMaxSize ) ;
	}
	THIS->m_callback ( THIS->m_state );//, THIS->m_list );
	//}
//#endif
}
// . this is called when we got a local RdbList
// . we need to call it to call the original caller callback
void gotListWrapper2 ( void *state , RdbList *list , Msg5 *msg5 ) {
	Msg0 *THIS = (Msg0 *) state;
	THIS->reset(); // delete m_msg5
	THIS->m_callback ( THIS->m_state );//, THIS->m_list );
}