commit 778f28485845813047ba9b1745ea965e85dc71bd
parent 99330d7c3c9d829d772df08b3923b23f223d8a24
Author: finwo <finwo@pm.me>
Date: Sat, 3 Jan 2026 19:36:18 +0100
2.30
Diffstat:
7 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,10 @@
+2.30 [KK 2008-10-25]
+- Reversioned to 2.30 in prepration for STABLE release.
+- Bugfix in Netbuffer::netwrite() (debug output of written data)
+- SIGPIPE gets ignored, see sys/main.cc
+- Fixed re-entrancy issues for gethostbyname() that applies to some
+ unices. See Backend::connect() (xr/backend/connect.cc).
+
2.22 [KK 2008-10-16]
- Implemented up/down state in back ends. Fixed up the docs.
- Rewrote msg() and debugmsg() handling: these are now macros that
diff --git a/Makefile b/Makefile
@@ -1,7 +1,7 @@
# Top-level Makefile for XR
# -------------------------
-VER = 2.22
+VER = 2.30
BINDIR = /usr/sbin
TAR = /tmp/crossroads-$(VER).tar.gz
AUTHOR = Karel Kubat <karel@kubat.nl>
diff --git a/doc/xr.odt b/doc/xr.odt
Binary files differ.
diff --git a/doc/xr.pdf b/doc/xr.pdf
Binary files differ.
diff --git a/xr/backend/connect.cc b/xr/backend/connect.cc
@@ -14,17 +14,22 @@ bool Backend::connect() {
strerror(errno);
// Resolve hostname, prepare binding
+ struct sockaddr_in backendaddr;
+ backendaddr.sin_family = AF_INET;
+ backendaddr.sin_port = htons(bdef.port());
struct hostent *hostaddr;
- if (! (hostaddr = gethostbyname(bdef.server().c_str())) ) {
+ static int locker;
+
+ Mutex::lock(&locker);
+ if ( (hostaddr = gethostbyname(bdef.server().c_str())) )
+ memcpy ((char *) &backendaddr.sin_addr.s_addr,
+ hostaddr->h_addr_list[0], hostaddr->h_length);
+ Mutex::unlock(&locker);
+ if (! hostaddr) {
socketclose (clsocket);
throw static_cast<Error>("Failed to resolve backend host '") +
bdef.server();
}
- struct sockaddr_in backendaddr;
- backendaddr.sin_family = AF_INET;
- backendaddr.sin_port = htons(bdef.port());
- memcpy ((char *) &backendaddr.sin_addr.s_addr,
- hostaddr->h_addr_list[0], hostaddr->h_length);
// Client socket goes into nonblocking mode, so we can connect
// and enforce a timeout later.
diff --git a/xr/netbuffer/netwrite.cc b/xr/netbuffer/netwrite.cc
@@ -42,7 +42,7 @@ unsigned Netbuffer::netwrite (int fd, int timeout) const {
ssize_t nwritten;
nwritten = write (fd, buf_data + totwritten, buf_sz - totwritten);
- if (config.debug()) {
+ if (config.debug() && nwritten > 0) {
ostringstream o;
o << "Sent " << nwritten << " bytes to fd " << fd << ": ";
for (unsigned i = totwritten; i < totwritten + nwritten; i++)
diff --git a/xr/sys/main.cc b/xr/sys/main.cc
@@ -22,7 +22,7 @@ int main (int argc, char **argv) {
PROFILE("main");
static int relevant_sig[] = {
- SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGTERM, SIGSTOP, SIGPIPE
+ SIGHUP, SIGINT, SIGQUIT, SIGABRT, SIGTERM, SIGSTOP
};
try {
@@ -34,6 +34,7 @@ int main (int argc, char **argv) {
// Load the signal handler.
for (unsigned i = 0; i < sizeof(relevant_sig) / sizeof(int); i++)
signal (relevant_sig[i], sigcatcher);
+ signal (SIGPIPE, SIG_IGN);
// Configure the balancer and start serving.
balancer.init();