[RFC] emi2 driver login behaviour

"Angel Fradejas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
My EMI2 provider from time to time leaves my connections in a zombie state:
althought I closed it, they see them as already open (they have problems
with their soft I guess). The result is that when I try to login again they
reject me with a "number of sessions exceeded" reason.

When that happens, the EMI2 driver gives up and does a shutdown. This is the
relevant code:

	    emimsg = make_emi60(privdata);
	    emi2_emimsg_send(conn, server, emimsg);
	    emimsg_destroy(emimsg);
	    result = wait_for_ack(privdata, server, 60, 30);
	    if (result == -2) {
		/* Are SMSCs going to return any temporary errors? If so,
		 * testing for those error codes should be added here. */
		error(0, "smsc_emi2: Server rejected our login, giving up");
		conn->why_killed = SMSCCONN_KILLED_WRONG_PASSWORD;
		conn_destroy(server);
		return NULL;
	    }
	    else if (result == 0) {
		error(0, "smsc_emi2: Got no reply to login attempt "
		      "within 30 s");
		conn_destroy(server);
		continue;
	    }
	    else if (result == -1) { /* Broken connection, already logged */
		conn_destroy(server);
		continue;
	    }

Eventually, the sessions they have will die and I will be able to login.

Others drivers will sleep and try again. I think this is the way to go, as
Kannel is meant to run 24/7 mostly unattended. The modifications needed to
do that are trivial. I have done it with good results.

What do you think?

Angel Fradejas.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.