activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hackerick4 <hackeri...@gmail.com>
Subject Connecting to invalid URI leads program crash.
Date Tue, 21 Nov 2017 02:56:21 GMT
Hello guys, 
I was using Paho C library but found a issue. I'm not it's a bug or not. 
Here are several lines of codes in C.  URI1 and URI2 are in valid URI for
active MQ, 
Why the MQTTAsync_connect function didn't report any error but success ? and
the program would crash after a few seconds. 

I am sure the code is normal if one of URIs is valid. 


               char* arr[] = { URI1, URI2 };
                conn_opts.keepAliveInterval = 20;
		conn_opts.connectTimeout = 1;
		conn_opts.cleansession = 1;
		conn_opts.onSuccess = onConnect;
		conn_opts.onFailure = onConnectFailure;
		conn_opts.context = client;
		conn_opts.serverURIs = arr;
		conn_opts.serverURIcount = 2;
		
		if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS) {
			logger << _ERROR << "Failed to start connect, return code : " << rc <<
endl;
		}



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Mime
View raw message