On 18 Jun 2007 08:24:33 +0200, Martin Rubey <[EMAIL PROTECTED]> wrote:

> > 2) If I inadvertently quit HyperDoc while running Axiom, I can restart it
> > with )hd.  But )hd doesn't provide a socket connection; this new HyperDoc is
> > "not connected to Axiom".  Is there any way of starting a "connected"
> > HyperDoc from an already-running Axiom?
>
> No, but I'd love to see a fix for that bug, too.

Attached are patches for this problem done by Waldek (Bug 281).
The patch is against current silver.

Regards,

Alfredo
diff --git a/src/sman/bookvol6.pamphlet b/src/sman/bookvol6.pamphlet
index d80388b..f0d9bd4 100644
--- a/src/sman/bookvol6.pamphlet
+++ b/src/sman/bookvol6.pamphlet
@@ -812,6 +812,8 @@ these structures which maintains the process list for axiom.
 #define NadaDelShitsky  2
 /* When a process dies start it up again */
 #define DoItAgain       3
+/* When hypertex dies, clean its socket */
+#define CleanHypertexSocket 4
 
 typedef struct spad_proc {
   int	proc_id;	/* process id of child */
@@ -1405,7 +1407,7 @@ start_the_hypertex(void)
     sprintf(prog, "%s -k -rv %s", HypertexProgram, VerifyRecordFile);
     spawn_of_hell(prog, NadaDelShitsky);
   }
-  else	spawn_of_hell(HypertexProgram, NadaDelShitsky);
+  else	spawn_of_hell(HypertexProgram, CleanHypertexSocket);
 }
 
 @
@@ -1517,6 +1519,14 @@ start_the_Axiom(char **envp)
 \subsection{clean\_up\_sockets}
 <<sman.cleanupsockets>>=
 static void
+clean_hypertex_socket(void)
+{
+   char name[256];
+   sprintf(name, "%s%d", MenuServerName, server_num);
+   unlink(name); 
+}
+
+static void
 clean_up_sockets(void)
 {
   char name[256];
@@ -1526,8 +1536,7 @@ clean_up_sockets(void)
   unlink(name);
   sprintf(name, "%s%d", SessionIOName, server_num);
   unlink(name);
-  sprintf(name, "%s%d", MenuServerName, server_num);
-  unlink(name);
+  clean_hypertex_socket();
 }
 
 @
@@ -1704,7 +1713,6 @@ monitor_children(void)
     if (dead_baby == -1 && death_signal) {
       kill_all_children();
       clean_up_sockets();
-      clean_up_terminal();
       sleep(2);
       exit(0);
     }
@@ -1731,7 +1739,6 @@ monitor_children(void)
     case Die:
       kill_all_children();
       clean_up_sockets();
-      clean_up_terminal();
       sleep(2);
       exit(0);
     case NadaDelShitsky:
@@ -1739,6 +1746,9 @@ monitor_children(void)
     case DoItAgain:
       spawn_of_hell(proc->command, DoItAgain);
       break;
+    case CleanHypertexSocket:
+      clean_hypertex_socket();
+      break;
     }
   }
 }
diff --git a/src/include/sman.h1 b/src/include/sman.h1
index 20dbc90..9645289 100755
--- a/src/include/sman.h1
+++ b/src/include/sman.h1
@@ -25,6 +25,7 @@ static void start_the_graphics(void);
 static void fork_Axiom(void);
 static void start_the_Axiom(char * * envp);
 static void clean_up_sockets(void);
+static void clean_hypertex_socket(void);
 static void read_from_spad_io(int ptcNum);
 static void read_from_manager(int ptcNum);
 static void manage_spad_io(int ptcNum);
diff --git a/src/hyper/hyper.pamphlet b/src/hyper/hyper.pamphlet
index 2126df1..53ecd9a 100644
--- a/src/hyper/hyper.pamphlet
+++ b/src/hyper/hyper.pamphlet
@@ -948,9 +948,11 @@ make_server_connections(void)
         fprintf(stderr, "(HyperDoc) Warning: Not connected to AXIOM Server!\n");
         MenuServerOpened = 0;
     }
-    else
-        MenuServerOpened = 1;
+    else {
 
+        atexit(&clean_socket);
+        MenuServerOpened = 1;
+    }
 
     /*
      * If I have opened the MenuServer socket, then I should also try to open
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to