Exemple #1
0
void xmlrpc_process(int rank)
{
	int retries, rc;
	int send_status;

	/* init blocking reader */
	xmlrpc_init_reader();
	xmlrpc_init_send_buf();
	xmlrpc_send_t * xmlrpcs;

	/* waiting for commands */
	for (;;) {
		xmlrpcs = xmlrpc_receive();
		if (!xmlrpcs) {
			LM_ERR("invalid receive sock info\n");
			goto end;
		}

		/* send msg */
		if (xmlrpc_sendmsg(xmlrpcs)) {
			LM_ERR("cannot send message\n");
			send_status = XMLRPC_SEND_FAIL;
		} else
			send_status = XMLRPC_SEND_SUCCESS;

		if (xmlrpc_sync_mode) {
			retries = XMLRPC_SEND_RETRY;

			if (xmlrpcs->process_idx >= 0 && xmlrpcs->process_idx < nr_procs) {
				do {
					rc = write(xmlrpc_status_pipes[xmlrpcs->process_idx][1], &send_status, sizeof(int));
				} while (rc < 0 && (IS_ERR(EINTR) || retries-- > 0));
				if (rc < 0)
					LM_ERR("cannot send status back to requesting process\n");
			}
		}
end:
		if (xmlrpcs)
			shm_free(xmlrpcs);
	}
}
Exemple #2
0
void xmlrpc_process(int rank)
{
	/* init blocking reader */
	xmlrpc_init_reader();
	xmlrpc_init_send_buf();
	xmlrpc_send_t * xmlrpcs;

	/* waiting for commands */
	for (;;) {
		xmlrpcs = xmlrpc_receive();
		if (!xmlrpcs) {
			LM_ERR("invalid receive sock info\n");
			goto end;
		}

		/* send msg */
		if (xmlrpc_sendmsg(xmlrpcs))
			LM_ERR("cannot send message\n");
end:
		if (xmlrpcs)
			shm_free(xmlrpcs);
	}
}