Maybe I'm missing something, but I always thought the XFree86 nolisten
code was overly complicated, and this just seems to make it worse.  When
we added -nolisten to Xsun, we got multiple listeners for free with a
simpler implementation, contained entirely in utils.c:

        else if ( strcmp( argv[i], "-nolisten") == 0)
        {
            if(++i < argc) {
                if (_XSERVTransNoListen(argv[i])) {
                    FatalError ("Failed to disable listen for %s transport",
                      argv[i]);
                }
            } else
                UseMsg();
        }

--
        -Alan Coopersmith-          [EMAIL PROTECTED]
         Sun Microsystems, Inc.     -     Sun Software Group
         Quality / User Experience (QUE)   -   Globalization
         Platform Globalization Engineering: X11 Development


Matthieu Herrb wrote:
Here's a patch to allow multiple '-nolisten' options on the command
line. To disable both IPv4 and IPv6 transports, one needs to say:

X -nolisten tcp -nolisten inet6

I'll add a documentation patch too later.

Index: xc/programs/Xserver/include/os.h
===================================================================
RCS file: /cvs/xf86/xc/programs/Xserver/include/os.h,v
retrieving revision 3.45
diff -u -r3.45 os.h
--- xc/programs/Xserver/include/os.h 4 Jul 2003 16:24:29 -0000 3.45
+++ xc/programs/Xserver/include/os.h 23 Jul 2003 20:34:47 -0000
@@ -480,5 +480,12 @@
extern void AbortDDX(void);
extern void ddxGiveUp(void);
extern int TimeSinceLastInputEvent(void);
+
+typedef struct NoListenList {
+ char *name;
+ struct NoListenList *next;
+} *NoListenListPtr;
+
+extern NoListenListPtr noListenList;
#endif /* OS_H */
Index: xc/programs/Xserver/os/connection.c
===================================================================
RCS file: /cvs/xf86/xc/programs/Xserver/os/connection.c,v
retrieving revision 3.61
diff -u -r3.61 connection.c
--- xc/programs/Xserver/os/connection.c 16 Jul 2003 01:39:00 -0000 3.61
+++ xc/programs/Xserver/os/connection.c 23 Jul 2003 20:34:47 -0000
@@ -186,7 +186,7 @@
Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
Bool PartialNetwork; /* continue even if unable to bind all addrs */
-char *protNoListen; /* don't listen on this protocol */
+NoListenListPtr noListenList; /* don't listen on these protocols */
static Pid_t ParentProcess;
#ifdef __UNIXOS2__
Pid_t GetPPID(Pid_t pid);
@@ -309,6 +309,7 @@
int i;
int partial;
char port[20];
+ NoListenListPtr p;
FD_ZERO(&AllSockets);
FD_ZERO(&AllClients);
@@ -323,13 +324,13 @@
FD_ZERO (&WellKnownConnections);
- sprintf (port, "%d", atoi (display));
+ snprintf (port, sizeof(port), "%d", atoi (display));
- if (protNoListen)
- if (_XSERVTransNoListen(protNoListen))
- {
- FatalError ("Failed to disable listen for %s", protNoListen);
- }
+ for (p = noListenList; p != NULL; p = p->next) {
+ if (_XSERVTransNoListen(p->name)) {
+ FatalError("Failed to disable listen for %s", p->name);
+ }
+ }
if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial,
&ListenTransCount, &ListenTransConns) >= 0) &&
Index: xc/programs/Xserver/os/utils.c
===================================================================
RCS file: /cvs/xf86/xc/programs/Xserver/os/utils.c,v
retrieving revision 3.89
diff -u -r3.89 utils.c
--- xc/programs/Xserver/os/utils.c 9 Jul 2003 15:27:35 -0000 3.89
+++ xc/programs/Xserver/os/utils.c 23 Jul 2003 20:34:47 -0000
@@ -602,6 +602,7 @@
{
int i, skip;
+ noListenList = NULL;
defaultKeyboardControl.autoRepeat = TRUE;
#ifdef PART_NET
@@ -816,8 +823,13 @@
#endif
else if ( strcmp( argv[i], "-nolisten") == 0)
{
- if(++i < argc)
- protNoListen = argv[i];
+ if(++i < argc) {
+ NoListenListPtr p = + (NoListenListPtr)xalloc(sizeof(struct NoListenList));
+ p->name = argv[i];
+ p->next = noListenList;
+ noListenList = p;
+ }
else
UseMsg();
}



Matthieu _______________________________________________ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel


_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to