int wsman_send_request(WsManClient * cl, WsXmlDocH request)
{
        int ret = 0;
#ifdef BENCHMARK
	struct timeval tv0, tv1;
	long long t0, t1;
#endif

	if (wsmc_lock(cl) != 0 ) {
		error("Client busy");
		return 1;
	}
	wsmc_reinit_conn(cl);

#ifdef BENCHMARK
	gettimeofday(&tv0, NULL);
#endif

	wsmc_handler(cl, request, NULL);
        if (cl->last_error != WS_LASTERR_OK) {
          warning("Couldn't send request to client: %s\n", cl->fault_string);
          ret = 1;
        }
#ifdef BENCHMARK
	gettimeofday(&tv1, NULL);
	t0 = tv0.tv_sec * 10000000 + tv0.tv_usec;
	t1 = tv1.tv_sec * 10000000 + tv1.tv_usec;
	transfer_time += t1 - t0;
#endif
	wsmc_unlock(cl);
	return ret;
}
Esempio n. 2
0
int wsman_send_request(WsManClient * cl, WsXmlDocH request)
{
#ifdef BENCHMARK
	struct timeval tv0, tv1;
	long long t0, t1;
#endif

	if ((g_dump_wsman_data) && (g_wsman_dumpfile != NULL))
	{
		fprintf (g_wsman_dumpfile, "\n\n--------------------------------------------\n");
		ws_xml_dump_node_tree(g_wsman_dumpfile, ws_xml_get_doc_root(request));
		fprintf (g_wsman_dumpfile, "\n");
	}

	if (wsmc_lock(cl) != 0 ) {
		error("Client busy");
		return 1;
	}
	wsmc_reinit_conn(cl);

#ifdef BENCHMARK
	gettimeofday(&tv0, NULL);
#endif

	wsmc_handler(cl, request, NULL);

#ifdef BENCHMARK
	gettimeofday(&tv1, NULL);
	t0 = tv0.tv_sec * 10000000 + tv0.tv_usec;
	t1 = tv1.tv_sec * 10000000 + tv1.tv_usec;
	transfer_time += t1 - t0;
#endif
	wsmc_unlock(cl);
	return 0;
}