cvs: php4 /ext/ircg ircg.c

From: Date: Mon, 27 May 2002 12:50:33 +0000
Subject: cvs: php4 /ext/ircg ircg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12112@lists.php.net to get a copy of this message
sas Mon May 27 08:50:33 2002 EDT Modified files: /php4/ext/ircg ircg.c Log: Flush data related to the streaming connection during php's rshutdown, and not during the ircg_set_current call, because it is otherwise not guaranteed that the HTTP header is sent out first. Index: php4/ext/ircg/ircg.c diff -u php4/ext/ircg/ircg.c:1.130 php4/ext/ircg/ircg.c:1.131 --- php4/ext/ircg/ircg.c:1.130 Thu May 23 12:56:36 2002 +++ php4/ext/ircg/ircg.c Mon May 27 08:50:32 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ircg.c,v 1.130 2002/05/23 16:56:36 sas Exp $ */ +/* $Id: ircg.c,v 1.131 2002/05/27 12:50:32 sas Exp $ */ /* {{{ includes */ @@ -219,6 +219,8 @@ static void msg_send(php_irconn_t *conn, smart_str *msg); +static php_irconn_t *flush_data; + /* }}} */ /* {{{ Default format messages */ @@ -699,21 +701,6 @@ #define ADD_HEADER(a) sapi_add_header(a, sizeof(a) - 1, 1) -/* - * The request shutdown will trigger this automatically. - * Because there is no ctx switch during the whole HTTP - * request, it is safe to delay this operation. - */ - -#if 0 -static void msg_http_start(php_irconn_t *conn TSRMLS_DC) -{ - sapi_send_headers(TSRMLS_C); -} -#else -#define msg_http_start (void) -#endif - static void http_closed_connection(int fd) { int *id, stored_id; @@ -1369,10 +1356,8 @@ } zend_hash_index_update(&h_fd2irconn, conn->fd, &Z_LVAL_PP(p1), sizeof(int), NULL); if (conn->file_fd == -1) { + flush_data = conn; irc_write_buf_add(&conn->wb, conn->fd); - msg_http_start(conn TSRMLS_CC); - msg_replay_buffer(conn); - irc_write_buf_flush(&conn->wb); } RETURN_TRUE; @@ -2089,6 +2074,23 @@ } /* }}} */ +/* {{{ PHP_RSHUTDOWN + */ +PHP_RSHUTDOWN_FUNCTION(ircg) +{ + if (flush_data) { + php_irconn_t *conn = flush_data; + + msg_replay_buffer(conn); + irc_write_buf_flush(&conn->wb); + + flush_data = NULL; + } + + return SUCCESS; +} +/* }}} */ + /* {{{ ircg_module_entry */ zend_module_entry ircg_module_entry = { STANDARD_MODULE_HEADER, @@ -2097,7 +2099,7 @@ PHP_MINIT(ircg), PHP_MSHUTDOWN(ircg), NULL, - NULL, + PHP_RSHUTDOWN(ircg), PHP_MINFO(ircg), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES

« previous php.cvs (#12112) next »