[JDEV] jabberd 1.4.3 release candidate
Matthias Wimmer
m at tthias.net
Thu Oct 9 20:31:57 CDT 2003
Hi!
Peter Saint-Andre schrieb am 2003-10-08 16:00:09:
> For the next week, the jabberd 1.4 team will accept code patches that
> fix known bugs in the code (NO NEW FEATURES!). Please send any patches
> to jdev at jabber.org before the end of the day on Wednesday, October 15.
I expect that jadc2s will not be in the 1.4.3 release as it is not
tagged in CVS. But in any case I fixed the problem that enabling karma
on client connections resulted in very instable connections.
I fixed three things:
- conn.c:
8 bits are 1 byte (not the oppsite) *g*
- conn.c:
It may happen that more data is read from a client connection,
that it would be allowed. Therefore c->read_bytes can become bigger
than (max_bits_per_sec / 8). Therefore "bytes" can't just be compared
for equality to 0 but must be compared to be "<= 0"
- jadc2s.c:
in check_karma() it may happen that only some entries at the beginning
of the queue are processed while the end of the queue is kept back. In
this case c2s->bad_conns was not updated and pointed to freed memory.
Tot kijk
Matthias
--
For kibibytes see:
http://www.iec.ch/online_news/etech/arch_2003/etech_0503/focus.htm
-------------- next part --------------
diff -Naur jadc2s/conn.c jadc2s-ratepatch/conn.c
--- jadc2s/conn.c 2003-03-12 00:00:34.000000000 +0100
+++ jadc2s-ratepatch/conn.c 2003-10-10 03:18:11.000000000 +0200
@@ -210,35 +210,35 @@
{
c->last_read = now;
c->read_bytes = 0;
- bytes = max_bits_per_sec * 8;
+ bytes = max_bits_per_sec / 8;
}
else
{
- bytes = (max_bits_per_sec * 8) - c->read_bytes;
+ bytes = (max_bits_per_sec / 8) - c->read_bytes;
}
/* See if the user ate all their karma */
- if (bytes == 0)
- {
- /* Create a new bad conn */
- bad_conn_t bad_conn;
- bad_conn = malloc(sizeof(struct bad_conn_st));
- bad_conn->c = c;
- bad_conn->last = now;
- bad_conn->next = NULL;
- /* Append it to the end of the bad conns list */
- if (c2s->bad_conns == NULL)
- c2s->bad_conns = bad_conn;
- else
- c2s->bad_conns_tail->next = bad_conn;
- /* Update the tail */
- c2s->bad_conns_tail = bad_conn;
-
- /* Reset the resolution */
- c2s->timeout = 1;
- }
+ if (bytes > 0)
+ return bytes;
- return bytes;
+ /* Create a new bad conn */
+ bad_conn_t bad_conn;
+ bad_conn = malloc(sizeof(struct bad_conn_st));
+ bad_conn->c = c;
+ bad_conn->last = now;
+ bad_conn->next = NULL;
+ /* Append it to the end of the bad conns list */
+ if (c2s->bad_conns == NULL)
+ c2s->bad_conns = bad_conn;
+ else
+ c2s->bad_conns_tail->next = bad_conn;
+ /* Update the tail */
+ c2s->bad_conns_tail = bad_conn;
+
+ /* Reset the resolution */
+ c2s->timeout = 1;
+
+ return 0;
}
/* process the xml data that's been read */
diff -Naur jadc2s/jadc2s.c jadc2s-ratepatch/jadc2s.c
--- jadc2s/jadc2s.c 2002-10-23 00:01:42.000000000 +0200
+++ jadc2s-ratepatch/jadc2s.c 2003-10-10 03:16:17.000000000 +0200
@@ -73,15 +73,17 @@
mio_read(c2s->mio, cur->c->fd);
/* cleanup and move on in the list */
free(cur);
- if (next == NULL)
- {
- c2s->bad_conns = NULL;
- /* XXX Make this a config option? */
- c2s->timeout = 15;
- break;
- }
+
cur = next;
}
+
+ /* update the pointer to the first bad connection */
+ c2s->bad_conns = cur;
+ if (c2s->bad_conns == NULL)
+ {
+ /* XXX Make this a config option? */
+ c2s->timeout = 15;
+ }
}
static void usage(void)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.jabber.org/jdev/attachments/20031010/221e03c7/attachment-0002.pgp>
More information about the JDev
mailing list