commit 9c22cc48450e3ae0488d0c3a175ae5df20d4258a
parent 29c6fce29f9572bacbaddb0dfe126b5e956e04dc
Author: finwo <finwo@pm.me>
Date: Sat, 3 Jan 2026 19:34:57 +0100
2.02
Diffstat:
9 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,13 @@
+2.02 [KK 2008-08-09] Changes to the Makefile & some sources to avoid
+warnings under RHL (thanks, Simon M.).
+Bytes processed by a back end is now administered in
+TcpDispatcher::writechunk() and not readchunk(). Reason: In HTTP mode,
+the target back end is not yet known upon the first read -- the first read
+from the client comes before dispatching. Thanks Simon M. for the bug
+report.
+All select()'s now check for errno==EINTR, incase XR gets a signal -1
+(for status report).
+
2.01 [KK 2008-08-08] Implemented flag -C (--close-sockets-fast): this
option *can* be used under heavy stress when too many network sockets
remain in TIME_WAIT state (try with 'netstat -n | grep TIME_WAIT').
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
# Top-level Makefile for XR
# -------------------------
-VER = 2.01
+VER = 2.02
BINDIR = /usr/sbin
TAR = /tmp/crossroads-$(VER).tar.gz
AUTHOR = Karel Kubat <karel@kubat.nl>
diff --git a/xr/Makefile b/xr/Makefile
@@ -1,6 +1,6 @@
# Configuration
-DIRS = $(shell find . -type d -mindepth 1 -maxdepth 1)
+DIRS = $(shell find . -mindepth 1 -maxdepth 1 -type d)
BUILDDIR = build
BIN = $(BUILDDIR)/xr
LIB = $(BUILDDIR)/libxr.a
@@ -34,7 +34,7 @@ $(BUILDDIR)/usage.h: etc/usage.txt
$(BIN): $(BUILDDIR)/libxr.a
$(CC) -g -o $(BIN) -L$(BUILDDIR) -lxr \
- $(shell etc/c-conf -vc $(BUILDIR)/config.cache lib \
+ $(shell etc/c-conf -vc $(BUILDDIR)/config.cache lib \
ucb nsl pthread socket m alf)
clean:
diff --git a/xr/fdset/readwriteable.cc b/xr/fdset/readwriteable.cc
@@ -27,8 +27,14 @@ int Fdset::readwriteable() const {
tvp = 0;
// Run the select.
- if (select (FD_SETSIZE, &readset, &writeset, &exceptset, tvp) < 0)
- throw ((Error) "Select failure: failed to wait for rw state");
+ if (select (FD_SETSIZE, &readset, &writeset, &exceptset, tvp) < 0) {
+ if (errno != EINTR)
+ throw ((Error) "Select failure: "
+ "failed to wait for read/writeablestate: "
+ + strerror(errno));
+ else
+ return (-1);
+ }
// Check for exceptions.
for (unsigned i = 0; i < set.size(); i++)
diff --git a/xr/fdset/writeable.cc b/xr/fdset/writeable.cc
@@ -25,8 +25,13 @@ int Fdset::writeable() const {
tvp = 0;
// Run the select.
- if (select (FD_SETSIZE, 0, &writeset, &exceptset, tvp) < 0)
- throw ((Error) "Select failure: failed to wait for writable state");
+ if (select (FD_SETSIZE, 0, &writeset, &exceptset, tvp) < 0) {
+ if (errno != EINTR)
+ throw ((Error) "Select failure: failed to wait for "
+ "writable state: " + strerror(errno));
+ else
+ return (-1);
+ }
// Check for exceptions.
for (unsigned i = 0; i < set.size(); i++)
diff --git a/xr/stopthread/execute.cc b/xr/stopthread/execute.cc
@@ -2,7 +2,6 @@
void Stopthread::execute() {
static int stopping;
- static int last_connections;
int loc_stopping;
if ( (loc_stopping = stopping) ) {
diff --git a/xr/sys/timestamp.cc b/xr/sys/timestamp.cc
@@ -10,6 +10,6 @@ string timestamp() {
sprintf (buf, "%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d,%3.3d",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec,
- tv.tv_usec / 1000);
+ int(tv.tv_usec / 1000));
return (buf);
}
diff --git a/xr/tcpdispatcher/readchunk.cc b/xr/tcpdispatcher/readchunk.cc
@@ -5,8 +5,6 @@ unsigned TcpDispatcher::readchunk (int src) {
if (nread < 0)
throw ((Error) "Read failed on fd " + src);
- balancer.backend(targetbackend()).addbytes (databufsize());
-
if (config.debug() && nread) {
ostringstream o;
o << "Got " << nread << " bytes from fd " << src << ": ";
diff --git a/xr/tcpdispatcher/writechunk.cc b/xr/tcpdispatcher/writechunk.cc
@@ -12,6 +12,8 @@ unsigned TcpDispatcher::writechunk (int dst, char const *b, unsigned blen) {
if (nwritten < 1)
throw ((Error) "Write failed");
+ balancer.backend(targetbackend()).addbytes (nwritten);
+
if (config.debug()) {
ostringstream o;
o << "Sent " << nwritten << " bytes to fd " << dst << ": ";