1997-09-03
1997-09-03 12:11:15 by Per Hedbor <ph@opera.com>
-
06583f15345f4361bb3a3f52d4ce1ebd60e7bbb0
(42 lines)
(+37/-5)
[
Show
| Annotate
]
Branch: 5.2
Experimental threaded accept handling (not working. :-) and gtext bugfixes
Rev: server/base_server/config/low_describers.pike:1.16
Rev: server/base_server/roxen.pike:1.122
Rev: server/modules/graphics/graphic_text.pike:1.64
Rev: server/modules/scripting/pikescript.pike:1.14
Rev: server/protocols/http.pike:1.40
1:
- constant cvs_version = "$Id: roxen.pike,v 1.121 1997/09/03 07:48:58 grubba Exp $";
+ constant cvs_version = "$Id: roxen.pike,v 1.122 1997/09/03 12:11:10 per Exp $";
#define IN_ROXEN
#include <roxen.h>
#include <config.h>
104:
// This is called for each incoming connection.
private static void accept_callback( object port )
{
- int q=QUERY(NumAccept);
+
object file;
-
+ int q=QUERY(NumAccept);
array pn=portno[port];
#ifdef DEBUG
242:
if(number_of_threads > 0)
handle = threaded_handle;
}
+
+ void accept_thread(object port,array pn)
+ {
+ program port_program = pn[-1];
+ mixed foo = pn[1];
+ array err;
+ object o;
+ catch {
+ while(1)
+ {
+ o = port->accept();
+ err = catch {
+ if(o) port_program(o,foo);
+ };
+ if(err)
+ perror("Error in accept_thread: %O\n",describe_backtrace(err));
+ }
+ };
+ }
+
#endif /* THREADS */
-
+
// Listen to a port, connected to the configuration 'conf', binding
// only to the netinterface 'ether', using 'requestprogram' as a
// protocol handled.
284:
ether=0;
if(ether)
sscanf(ether, "addr:%s", ether);
-
+ #ifdef 0&&(defined(THREADS)
+ if(!port->bind(port_no, 0, ether))
+ #else
if(!port->bind(port_no, accept_callback, ether))
-
+ #endif
{
- if(ether==0 || !port->bind(port_no, accept_callback))
+ #ifdef 0&&defined(THREADS)
+ if(ether==0 || !port->bind(port_no,accept_callback))
+ #else
+ if(ether==0 || !port->bind(port_no,))
+ #endif
{
#ifdef SOCKET_DEBUG
perror("SOCKETS: -> Failed.\n");
303:
}
}
portno[port]=({ port_no, conf, ether||"Any", 0, requestprogram });
+ #if 0&&defined(THREADS)
+ thread_create(accept_thread, port,portno[port]);
+ #endif
#ifdef SOCKET_DEBUG
perror("SOCKETS: -> Ok.\n");
#endif
2084: Inside #if defined(THREADS)
void shuffle_thread(int id)
{
#ifdef THREAD_DEBUG
- perror("shuffle_thread "+id+" started.\n");
+ // perror("shuffle_thread "+id+" started.\n");
#endif
while(mixed s=shuffle_queue->read())
_shuffle(@s);