diff options
author | tron <tron@pkgsrc.org> | 2001-02-24 22:40:39 +0000 |
---|---|---|
committer | tron <tron@pkgsrc.org> | 2001-02-24 22:40:39 +0000 |
commit | 32c42d46ce8643bd03e050d1c5ed53eddd18a8bf (patch) | |
tree | 58b03b5b473cc6ee8c2941f76d35664ee6d9af0c /news/knews | |
parent | e6985409dc4038ade0970c37190b3ba0481c46b1 (diff) | |
download | pkgsrc-32c42d46ce8643bd03e050d1c5ed53eddd18a8bf.tar.gz |
Bump the version number to 1.0nb3 after major rework of IPv6 patch:
- No busy loops when connecting to the NNTP server.
- Handle multiple records return by getaddrinfo(3) at the proper location.
- Avoid unnecessary socket creations and deletions by always passing the
correct address family to open_socket().
Diffstat (limited to 'news/knews')
-rw-r--r-- | news/knews/Makefile | 4 | ||||
-rw-r--r-- | news/knews/files/patch-sum | 10 | ||||
-rw-r--r-- | news/knews/patches/patch-af | 10 | ||||
-rw-r--r-- | news/knews/patches/patch-ag | 76 | ||||
-rw-r--r-- | news/knews/patches/patch-ah | 24 | ||||
-rw-r--r-- | news/knews/patches/patch-ai | 57 |
6 files changed, 107 insertions, 74 deletions
diff --git a/news/knews/Makefile b/news/knews/Makefile index d795e896ffd..9fafe3280a8 100644 --- a/news/knews/Makefile +++ b/news/knews/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.28 2001/02/23 22:19:41 tron Exp $ +# $NetBSD: Makefile,v 1.29 2001/02/24 22:40:39 tron Exp $ DISTNAME= knews-1.0b.1 -PKGNAME= knews-1.0nb2 +PKGNAME= knews-1.0nb3 CATEGORIES= news x11 MASTER_SITES= http://www.matematik.su.se/~kjj/ diff --git a/news/knews/files/patch-sum b/news/knews/files/patch-sum index d93f20efbe5..8cb10e6594a 100644 --- a/news/knews/files/patch-sum +++ b/news/knews/files/patch-sum @@ -1,14 +1,14 @@ -$NetBSD: patch-sum,v 1.5 2001/02/23 22:19:41 tron Exp $ +$NetBSD: patch-sum,v 1.6 2001/02/24 22:40:40 tron Exp $ MD5 (patch-aa) = 95cd0655c3bc770d6450343e204ecf97 MD5 (patch-ab) = a7803c0d155e79576a8f0d4e94933786 MD5 (patch-ac) = b377e050b3aad321de2ef795395a1ac8 MD5 (patch-ad) = 42f9dd9fdfdca698de9b849f4a8dea54 MD5 (patch-ae) = 166cf61034320c7f90c68f7db4bfad1c -MD5 (patch-af) = ad4e19fce0fb73c50338440d0e6a0acf -MD5 (patch-ag) = 341e0ec9dbc24ea5bc7cd760933937c6 -MD5 (patch-ah) = 7cd2ede2df1bab2ed952070d2fab6ae5 -MD5 (patch-ai) = ee3eadf8b41933f0cb25e646df210e93 +MD5 (patch-af) = f6f7662ff65939090971bf1cbbe1765b +MD5 (patch-ag) = 81db2b27e60ee1b2a4900e82287387ee +MD5 (patch-ah) = bcf7cb17cd26e3fb086726355748da55 +MD5 (patch-ai) = ee012afd5da8abba1a16b787fdbdd5c0 MD5 (patch-aj) = 1728399cf60b4c9c1bda9d3790edf6e8 MD5 (patch-ak) = 2d1dd4096bbbff6a4f75afda3a454537 MD5 (patch-al) = d01ee21b4c0c6ca45c9b8ab8bd79bb43 diff --git a/news/knews/patches/patch-af b/news/knews/patches/patch-af index 66a17b429c8..0aae44cb9d1 100644 --- a/news/knews/patches/patch-af +++ b/news/knews/patches/patch-af @@ -1,7 +1,7 @@ -$NetBSD: patch-af,v 1.3 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-af,v 1.4 2001/02/24 22:40:40 tron Exp $ --- src/sysdeps.h.orig Fri Jan 9 18:16:24 1998 -+++ src/sysdeps.h Fri Feb 23 22:08:23 2001 ++++ src/sysdeps.h Sat Feb 24 23:30:34 2001 @@ -2,7 +2,11 @@ * Copyright (C) 1995, 1996 Karl-Johan Johnsson. */ @@ -14,12 +14,14 @@ $NetBSD: patch-af,v 1.3 2001/02/23 22:19:42 tron Exp $ #define NNTP_PORT 119 #define FTP_PORT 21 -@@ -14,7 +18,7 @@ +@@ -14,7 +18,9 @@ extern void abort_callback(Widget, XtPointer, XtPointer); extern SERV_ADDR *get_host(char*, unsigned short, int); -extern int open_socket(void); -+extern int open_socket(int); ++extern SERV_ADDR *next_addr(SERV_ADDR *); ++extern void free_addr(SERV_ADDR *); ++extern int open_socket(SERV_ADDR *); extern int connect_socket(int, SERV_ADDR*); extern int open_duplex(int*); extern int bind_and_listen(int); diff --git a/news/knews/patches/patch-ag b/news/knews/patches/patch-ag index 0e7aefcfbbb..aa808b74119 100644 --- a/news/knews/patches/patch-ag +++ b/news/knews/patches/patch-ag @@ -1,7 +1,7 @@ -$NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ag,v 1.4 2001/02/24 22:40:40 tron Exp $ --- src/sysdeps.c.orig Tue Dec 29 11:46:52 1998 -+++ src/sysdeps.c Fri Feb 23 23:11:36 2001 ++++ src/sysdeps.c Sat Feb 24 23:31:43 2001 @@ -20,8 +20,8 @@ #include <netinet/in.h> #include <arpa/inet.h> @@ -64,7 +64,7 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ SERV_ADDR *ret; struct in_addr addr; unsigned short port; -@@ -332,14 +359,15 @@ +@@ -332,14 +359,38 @@ ret->port = port; return ret; @@ -72,53 +72,57 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ } -int open_socket(void) -+int open_socket(int family) ++SERV_ADDR *next_addr(SERV_ADDR *addr) ++ ++{ ++#ifdef USE_INET6 ++ return addr->ai_next; ++#else ++ return NULL; ++#endif ++} ++void free_addr(SERV_ADDR *addr) ++ ++{ ++#ifdef USE_INET6 ++ freeaddrinfo(addr); ++#else ++ XtFree((char *)addr); ++#endif ++} ++ ++int open_socket(SERV_ADDR *addr) { int fd, tmp; do { - fd = socket(PF_INET, SOCK_STREAM, 0); -+ fd = socket(family, SOCK_STREAM, 0); ++#ifdef USE_INET6 ++ fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); ++#else ++ fd = socket(AF_INET, SOCK_STREAM, 0); ++#endif } while (fd < 0 && errno == EINTR); if (fd < 0) { -@@ -372,6 +400,35 @@ +@@ -372,8 +423,15 @@ int connect_socket(int fd, SERV_ADDR *addr) { +- struct sockaddr_in serv_addr; + int tmp; +#ifdef USE_INET6 -+ int family; -+ -+ family = AF_INET; -+ while (addr) { -+ if (family != addr->ai_family) { -+ int newsocket; -+ -+ newsocket = open_socket(addr->ai_family); -+ if (newsocket < 0) -+ return -1; -+ if (dup2(newsocket, fd) < 0) -+ close(newsocket); ++ do { ++ tmp = connect(fd, addr->ai_addr, addr->ai_addrlen); ++ } while (tmp < 0 && errno == EINTR); + -+ close(newsocket); -+ family = addr->ai_family; -+ } -+ -+ do { -+ if ((connect(fd, addr->ai_addr, addr->ai_addrlen) == 0) || -+ (errno == EISCONN)) -+ return 0; -+ } while (would_block(fd, errno)); -+ -+ addr = addr->ai_next; -+ } -+ -+ return -1; ++ return tmp; +#else - struct sockaddr_in serv_addr; - int tmp; ++ struct sockaddr_in serv_addr; -@@ -390,6 +447,7 @@ + if (!addr) { + fputs("knews: connect_socket: addr is NULL!!!\n", stderr); +@@ -390,6 +448,7 @@ } while (tmp < 0 && errno == EINTR); return tmp; @@ -126,7 +130,7 @@ $NetBSD: patch-ag,v 1.3 2001/02/23 22:19:42 tron Exp $ } #if 0 /* Misc stuff for ftp routines */ -@@ -548,7 +606,7 @@ +@@ -548,7 +607,7 @@ char *get_mailhostname(void) { struct utsname un = {{0,},}; diff --git a/news/knews/patches/patch-ah b/news/knews/patches/patch-ah index d3c4b634d5f..8e7a7243620 100644 --- a/news/knews/patches/patch-ah +++ b/news/knews/patches/patch-ah @@ -1,7 +1,7 @@ -$NetBSD: patch-ah,v 1.1 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ah,v 1.2 2001/02/24 22:40:40 tron Exp $ --- src/xutil.c.orig Fri Jan 9 18:16:20 1998 -+++ src/xutil.c Fri Feb 23 22:44:30 2001 ++++ src/xutil.c Sat Feb 24 23:32:58 2001 @@ -18,6 +18,7 @@ #include "resource.h" #include "save.h" @@ -10,26 +10,12 @@ $NetBSD: patch-ah,v 1.1 2001/02/23 22:19:42 tron Exp $ #include "server.h" #include "tag.h" #include "thread.h" -@@ -40,6 +41,10 @@ - #include <X11/xpm.h> - #endif - -+#if defined(USE_INET6) -+#include <netdb.h> -+#endif -+ - void set_curr_art(ARTICLE *art, int center) - { - if (global.mode == NewsModeThread) { -@@ -343,7 +348,11 @@ +@@ -343,7 +344,7 @@ qf(main_server); server_close(main_server); -+#if defined(USE_INET6) -+ freeaddrinfo(global.serv_addr); -+#else - XtFree(global.serv_addr); -+#endif +- XtFree(global.serv_addr); ++ free_addr(global.serv_addr); global.serv_addr = NULL; clear_thread_context(main_thr); diff --git a/news/knews/patches/patch-ai b/news/knews/patches/patch-ai index dd50db50ba2..ea5f798cea7 100644 --- a/news/knews/patches/patch-ai +++ b/news/knews/patches/patch-ai @@ -1,7 +1,7 @@ -$NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ +$NetBSD: patch-ai,v 1.2 2001/02/24 22:40:40 tron Exp $ --- src/server.c.orig Fri Jan 9 18:16:22 1998 -+++ src/server.c Fri Feb 23 22:41:48 2001 ++++ src/server.c Sat Feb 24 23:24:45 2001 @@ -2,19 +2,21 @@ * Copyright (C) 1995, 1996 Karl-Johan Johnsson. */ @@ -26,7 +26,7 @@ $NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ struct SERVER { int fd; char *buffer; -@@ -128,12 +130,12 @@ +@@ -128,30 +130,35 @@ * tell != 0 means tell about errors * tell > 1 means say what you're doing */ @@ -35,9 +35,50 @@ $NetBSD: patch-ai,v 1.1 2001/02/23 22:19:42 tron Exp $ { long tmp; - server_close(server); +- server_close(server); - server->fd = open_socket(); -+ server->fd = open_socket(AF_INET); - if (server->fd < 0) { - set_message("Error: Failed to create socket!", True); - return -1; +- if (server->fd < 0) { +- set_message("Error: Failed to create socket!", True); +- return -1; +- } +- +- if (tell > 1) +- set_message("Server contacted, waiting for response...", False); +- +- tmp = connect_socket(server->fd, addr); +- +- if (tmp < 0 && would_block(server->fd, errno)) { +- if (tell == 0) +- return 0; /* don't block */ +- +- tmp = 0; +- do_wait(&server->fd, True, server->quit_func, server); +- if (server->fd < 0) ++ while (addr) { ++ server_close(server); ++ server->fd = open_socket(addr); ++ if (server->fd < 0) { ++ set_message("Error: Failed to create socket!", True); + return -1; ++ } ++ ++ if (tell > 1) ++ set_message("Server contacted, waiting for response...", False); ++ ++ tmp = connect_socket(server->fd, addr); ++ ++ if (tmp < 0 && would_block(server->fd, errno)) { ++ if (tell == 0) ++ return 0; /* don't block */ ++ ++ tmp = 0; ++ do_wait(&server->fd, True, server->quit_func, server); ++ if (server->fd >= 0) ++ break; ++ ++ } ++ ++ addr = next_addr(addr); + } + + server->buffer[0] = '\0'; |