2004-08-11
2004-08-11 12:11:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
b303404ce858846619079e6470eeabd1cb7e453c
(46 lines)
(+33/-13)
[
Show
| Annotate
]
Branch: 5.2
Fixed race in chain().
FD_DEBUG is now verbose even when not running with REQUEST_DEBUG.
CHECK_FD_SAFE_USE is now somewhat more paranoid.
Rev: server/protocols/http.pike:1.460
2:
// Modified by Francesco Chemolli to add throttling capabilities.
// Copyright © 1996 - 2004, Roxen IS.
- constant cvs_version = "$Id: http.pike,v 1.459 2004/06/30 16:59:34 mast Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.460 2004/08/11 12:11:06 grubba Exp $";
// #define REQUEST_DEBUG
#define MAGIC_ERROR
30:
#endif
#ifdef FD_DEBUG
+ #ifdef REQUEST_DEBUG
+ #define FD_WERR(X) REQUEST_WERR(X)
+ #else
+ #define FD_WERR(X) werror("%s\n", (X))
+ #endif
#define MARK_FD(X) do { \
int _fd = my_fd && my_fd->query_fd ? my_fd->query_fd() : -1; \
- REQUEST_WERR("FD " + (_fd == -1 ? sprintf ("%O", my_fd) : _fd) + ": " + (X)); \
+ FD_WERR("FD " + (_fd == -1 ? sprintf ("%O", my_fd) : _fd) + ": " + (X)); \
mark_fd(_fd, (X)+" "+remoteaddr); \
} while (0)
#else
61: Inside #if defined(DEBUG)
#ifdef DEBUG
#define CHECK_FD_SAFE_USE do { \
- if (this_thread() != roxen->backend_thread && \
+ if (my_fd && this_thread() != roxen->backend_thread && \
(my_fd->query_read_callback() || my_fd->query_write_callback() || \
my_fd->query_close_callback() || \
!zero_type (find_call_out (do_timeout)))) \
- error ("Got callbacks but not called from backend thread.\n"); \
+ error ("Got callbacks but not called from backend thread.\n" \
+ "rcb:%O\n" \
+ "wcb:%O\n" \
+ "ccb:%O\n" \
+ "timeout:%O\n", \
+ my_fd->query_read_callback(), \
+ my_fd->query_write_callback(), \
+ my_fd->query_close_callback(), \
+ find_call_out (do_timeout)); \
} while (0)
#else
#define CHECK_FD_SAFE_USE do {} while (0)
842:
}
break;
}
+ } else {
+ leftovers = data;
}
TIMER_END(parse_got_2_more_data);
if (!(< "HTTP/1.0", "HTTP/0.9" >)[prot]) {
2455:
void chain(object f, object c, string le)
{
my_fd = f;
+
+ CHECK_FD_SAFE_USE;
+
port_obj = c;
processed = 0;
do_not_disconnect=-1; // Block destruction until we return.
MARK_FD("HTTP kept alive");
time = predef::time();
- if ( le && strlen( le ) )
- got_data( 0,le );
- else
- {
- // If no pipelined data is available, call out...
- remove_call_out(do_timeout);
- call_out(do_timeout, 90);
- }
-
+
if(!my_fd)
{
if(do_not_disconnect == -1)
2477:
do_not_disconnect=0;
disconnect();
}
+ return;
}
else
{
2484:
do_not_disconnect = 0;
f->set_nonblocking(!processed && got_data, f->query_write_callback(), close_cb);
}
+
+ if ( le && strlen( le ) )
+ got_data( 0,le );
+ else
+ {
+ // If no pipelined data is available, call out...
+ remove_call_out(do_timeout);
+ call_out(do_timeout, 90);
}
-
+ }
Stdio.File connection( )
{