Revision 115d74b9 ALTOclient/ALTOclient.c

View differences:

ALTOclient/ALTOclient.c
406 406
		if (ctx) break;
407 407
	}
408 408

  
409
	if (!ctx) {
410
		alto_debugf("*** WARNING: xmlNanoHTTPMethod failed! Make sure ALTO server is reachable (NAT issue?)..");
411
		fprintf(stderr, "URL was '%s'.", url);
412
		return NULL;
413
	}
409 414
	assertCheck(ctx, "xmlNanoHTTPMethod failed! Make sure ALTO server is reachable (NAT issue?)..");
410 415

  
411 416
	free(ct);
......
454 459
	free(data);
455 460
	data = NULL;
456 461

  
462
	if (!ctx) return NULL;
463

  
457 464
	alto_debugf("%s: POST ok.\n", __FUNCTION__);
458 465

  
459 466
	memset(alto_reply_buf_nano, 0, ALTO_REP_BUF_SIZE);
......
1251 1258
	returnIf(num < 0, "<0 elements?", 0);
1252 1259

  
1253 1260
	// set new state
1261
	if (queryState == ALTO_QUERY_INPROGRESS) {
1262
		alto_debugf("*** WARNING: Calling ALTO_query_exec while query is still in progress! Race condition?!\n");
1263
		return 0;
1264
	}
1254 1265
	queryState = ALTO_QUERY_INPROGRESS;
1255 1266

  
1256 1267
	// first purge existing DB entries
......
1302 1313
	ALTO_XML_res = xmlReadFile("reply.xml",NULL,XML_PARSE_RECOVER);
1303 1314
#endif
1304 1315

  
1305
	// Step 3: Parse the XML to the DB
1306
	alto_parse_from_XML(ALTO_DB_res, ALTO_XML_res);
1316
	if (ALTO_XML_res) {
1317
		// Step 3: Parse the XML to the DB
1318
		alto_parse_from_XML(ALTO_DB_res, ALTO_XML_res);
1307 1319

  
1308
	// ###### Big Magic ######
1309
	// And now check for the corresponding rating
1310
	alto_do_the_magic(ALTO_DB_req, ALTO_DB_res);
1320
		// ###### Big Magic ######
1321
		// And now check for the corresponding rating
1322
		alto_do_the_magic(ALTO_DB_req, ALTO_DB_res);
1323

  
1324
		xmlFreeDoc(ALTO_XML_res);
1325
		ALTO_XML_res = NULL;
1326
	}
1311 1327

  
1312 1328
	// free xml data
1313 1329
	xmlFreeDoc(ALTO_XML_req);
1314
	xmlFreeDoc(ALTO_XML_res);
1315 1330
	ALTO_XML_req = NULL;
1316
	ALTO_XML_res = NULL;
1317 1331

  
1318 1332
	// purge the intermediate DB
1319 1333
	alto_purge_db(ALTO_DB_res);
1320 1334
}
1321 1335

  
1322 1336

  
1323

  
1324

  
1325

  
1326

  
1327

  
1328

  
1329

  

Also available in: Unified diff