cvs: php4 /ext/ircg ircg.c
| From: | Sascha Schumann | Date: | Tue, 09 Jan 2001 02:58:57 +0000 |
| Subject: | cvs: php4 /ext/ircg ircg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3500@lists.php.net to get a copy of this message | ||
sas Mon Jan 8 18:58:57 2001 EDT
Modified files:
/php4/ext/ircg ircg.c
Log:
Use sapi_send_headers() and use the simpler zend_llist_apply*
function for traversing the message buffer.
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.8 php4/ext/ircg/ircg.c:1.9
--- php4/ext/ircg/ircg.c:1.8 Mon Jan 8 18:00:28 2001
+++ php4/ext/ircg/ircg.c Mon Jan 8 18:58:56 2001
@@ -271,24 +271,9 @@
static void msg_http_start(php_irconn_t *conn)
{
ADD_HEADER("Pragma: no-cache");
- sapi_flush();
+ sapi_send_headers();
}
-static void msg_replay_buffer(php_irconn_t *conn)
-{
- zend_llist_position pos;
- void *pmsg;
- smart_str *msg;
-
- pmsg = zend_llist_get_first_ex(&conn->buffer, &pos);
-
- while (pmsg) {
- msg = pmsg;
- send(conn->fd, msg->c, msg->len, 0);
- pmsg = zend_llist_get_next_ex(&conn->buffer, &pos);
- }
-}
-
static void msg_empty_buffer(php_irconn_t *conn)
{
zend_llist_clean(&conn->buffer);
@@ -304,6 +289,16 @@
smart_str_append_ex(&msg2, msg, 1);
zend_llist_add_element(&conn->buffer, &msg2);
}
+}
+
+static void msg_send_apply(void *data, void *arg)
+{
+ msg_send(arg, data);
+}
+
+static void msg_replay_buffer(php_irconn_t *conn)
+{
+ zend_llist_apply_with_argument(&conn->buffer, msg_send_apply, conn);
}
static void msg_handler(irconn_t *ircc, const char *chan, const char *from,