changeset 13256:7ead7b8aea63

[gaim-migrate @ 15622] Remove the latency code because 1. It uses sleep, which would block everything if it actually worked 2. It doesn't work because we don't use AIM_TX_IMMEDIATE instead of AIM_TX_QUEUED 3. I'm going to be getting rid of AIM_TX_IMMEDIATE and AIM_TX_QUEUED and will be using a GaimCircBuffer for transmission at all times committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 12 Feb 2006 22:21:08 +0000
parents f280bf585fb3
children d7983c1d79bb
files src/protocols/oscar/conn.c src/protocols/oscar/oscar.c src/protocols/oscar/oscar.h src/protocols/oscar/txqueue.c
diffstat 4 files changed, 2 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/conn.c	Sun Feb 12 22:15:12 2006 +0000
+++ b/src/protocols/oscar/conn.c	Sun Feb 12 22:21:08 2006 +0000
@@ -241,7 +241,6 @@
 	conn->type = -1;
 	conn->seqnum = 0;
 	conn->lastactivity = 0;
-	conn->forcedlatency = 0;
 	conn->handlerlist = NULL;
 
 	sess->oscar_connections = g_list_prepend(sess->oscar_connections, conn);
@@ -359,7 +358,6 @@
 	conn->seqnum = src->seqnum;
 	conn->internal = src->internal;
 	conn->lastactivity = src->lastactivity;
-	conn->forcedlatency = src->forcedlatency;
 	conn->sessv = src->sessv;
 	aim_clonehandlers(sess, conn, src);
 
@@ -404,33 +402,6 @@
 }
 
 /**
- * Set a forced latency value for connection.  Basically causes
- * @newval seconds to be spent between transmits on a connection.
- *
- * This is my lame attempt at overcoming not understanding the rate
- * limiting.
- *
- * XXX: This should really be replaced with something that scales and
- * backs off like the real rate limiting does.
- *
- * @param conn Conn to set latency for.
- * @param newval Number of seconds to force between transmits.
- * @return Returns -1 if the connection does not exist, zero otherwise.
- */
-int
-aim_conn_setlatency(OscarConnection *conn, int newval)
-{
-
-	if (!conn)
-		return -1;
-
-	conn->forcedlatency = newval;
-	conn->lastactivity = 0; /* reset this just to make sure */
-
-	return 0;
-}
-
-/**
  * Determine if a connection is connecting.
  *
  * @param conn Connection to examine.
--- a/src/protocols/oscar/oscar.c	Sun Feb 12 22:15:12 2006 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Feb 12 22:21:08 2006 +0000
@@ -5742,20 +5742,12 @@
 		     limit, disconnect,
 		     windowsize);
 
-	/* XXX fix these values */
-	if (code == AIM_RATE_CODE_CHANGE) {
-		if (currentavg >= clear)
-			aim_conn_setlatency(fr->conn, 0);
-	} else if (code == AIM_RATE_CODE_WARNING) {
-		aim_conn_setlatency(fr->conn, windowsize/4);
-	} else if (code == AIM_RATE_CODE_LIMIT) {
+	if (code == AIM_RATE_CODE_LIMIT)
+	{
 		gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."),
 						  _("The last action you attempted could not be "
 							"performed because you are over the rate limit. "
 							"Please wait 10 seconds and try again."));
-		aim_conn_setlatency(fr->conn, windowsize/2);
-	} else if (code == AIM_RATE_CODE_CLEARLIMIT) {
-		aim_conn_setlatency(fr->conn, 0);
 	}
 
 	return 1;
--- a/src/protocols/oscar/oscar.h	Sun Feb 12 22:15:12 2006 +0000
+++ b/src/protocols/oscar/oscar.h	Sun Feb 12 22:21:08 2006 +0000
@@ -398,7 +398,6 @@
 	guint32 status;
 	void *internal; /* internal conn-specific libfaim data */
 	time_t lastactivity; /* time of last transmit */
-	int forcedlatency;
 	void *handlerlist;
 	OscarSession *sessv; /* pointer to parent session */
 	void *inside; /* only accessible from inside libfaim */
@@ -637,8 +636,6 @@
 faim_export int aim_tx_flushqueue(OscarSession *);
 faim_export void aim_tx_purgequeue(OscarSession *);
 
-faim_export int aim_conn_setlatency(OscarConnection *conn, int newval);
-
 faim_export int aim_conn_addhandler(OscarSession *, OscarConnection *conn, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags);
 faim_export int aim_clearhandlers(OscarConnection *conn);
 
--- a/src/protocols/oscar/txqueue.c	Sun Feb 12 22:15:12 2006 +0000
+++ b/src/protocols/oscar/txqueue.c	Sun Feb 12 22:21:08 2006 +0000
@@ -259,21 +259,6 @@
 		if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS))
 			continue;
 
-		/*
-		 * And now for the meager attempt to force transmit
-		 * latency and avoid missed messages.
-		 */
-		if ((cur->conn->lastactivity + cur->conn->forcedlatency) >= time(NULL)) {
-			/*
-			 * XXX should be a break! we don't want to block the
-			 * upper layers
-			 *
-			 * XXX or better, just do this right.
-			 *
-			 */
-			sleep((cur->conn->lastactivity + cur->conn->forcedlatency) - time(NULL));
-		}
-
 		/* XXX this should call the custom "queuing" function!! */
 		aim_tx_sendframe(sess, cur);
 	}