]> granicus.if.org Git - php/commitdiff
Add thttpd-dependent interface for maintaining persistent connections on
authorSascha Schumann <sas@php.net>
Mon, 13 Nov 2000 13:23:56 +0000 (13:23 +0000)
committerSascha Schumann <sas@php.net>
Mon, 13 Nov 2000 13:23:56 +0000 (13:23 +0000)
an iterative web-server. This will be used by the IRCG extension.

sapi/thttpd/php_thttpd.h
sapi/thttpd/thttpd.c

index e2e070330f1c2734e15e11d6cbc137fb92839f68..699ac5d83dc2bb9528da9f5fee24af662361b1d3 100644 (file)
@@ -27,4 +27,9 @@ void   thttpd_php_shutdown(void);
 void    thttpd_php_init(void);
 off_t   thttpd_php_request(httpd_conn *hc);
 
+void    thttpd_register_on_close(void (*)(int));
+void    thttpd_closed_conn(int fd);
+int             thttpd_get_fd(void);
+void    thttpd_set_dont_close(void);
+
 #endif
index 37104565a96a8a4602774b46b0319a7fc4a97503..1d1467bd4479ef443c9f8d15444e62b43c17f64e 100644 (file)
@@ -27,6 +27,7 @@
 typedef struct {
        httpd_conn *hc;
        int post_off;
+       void (*on_close)(int);
 } php_thttpd_globals;
 
 static php_thttpd_globals thttpd_globals;
@@ -283,6 +284,26 @@ off_t thttpd_php_request(httpd_conn *hc)
        return 0;
 }
 
+void thttpd_register_on_close(void (*arg)(int)) 
+{
+       TG(on_close) = arg;
+}
+
+void thttpd_closed_conn(int fd)
+{
+       if (TG(on_close)) TG(on_close)(fd);
+}
+
+int thttpd_get_fd(void)
+{
+       return TG(hc)->conn_fd;
+}
+
+void thttpd_set_dont_close(void)
+{
+       TG(hc)->file_address = (char *) 1;
+}
+
 void thttpd_php_init(void)
 {
        sapi_startup(&sapi_module);