std::string GCGV_ReqGetNodes::OnRequest(const char* JSON) {
    SetupRequest(JSON);

    FindNodes();

    BuildReply();

    return reply.GetAndClear();
}
Example #2
0
	void SendRequests()
	{
		process_mutex.Lock();

		query_queue q;
		this->Lock();
		queries.swap(q);
		this->Unlock();

		if (q.empty())
		{
			process_mutex.Unlock();
			return;
		}

		for (unsigned int i = 0; i < q.size(); ++i)
		{
			LDAPRequest *req = q[i];
			int ret = req->run();

			if (ret == LDAP_SERVER_DOWN || ret == LDAP_TIMEOUT)
			{
				/* try again */
				try
				{
					Reconnect();
				}
				catch (const LDAPException &)
				{
				}

				ret = req->run();
			}

			BuildReply(ret, req);

			this->Lock();
			results.push_back(req);
			this->Unlock();
		}

		me->Notify();

		process_mutex.Unlock();
	}