Index: trunk/FACT++/dim/README_v20.txt
===================================================================
--- trunk/FACT++/dim/README_v20.txt	(revision 18097)
+++ trunk/FACT++/dim/README_v20.txt	(revision 18349)
@@ -1,4 +1,4 @@
 
-                    DIM version 20r13 Release Notes
+                    DIM version 20r15 Release Notes
 
 Notes 1 and 2 for Unix Users only
@@ -17,5 +17,17 @@
 		Dns </dev/null >& dns.log &
 
-NOTE 3: The Version Number service provided by servers is now set to 2013.
+NOTE 3: The Version Number service provided by servers is now set to 2015.
+
+01/09/2015
+Changes for version 2015:
+    - A DIM Server did not properly accept a DimServer::stop(), folowed by a DimServer::start(),
+      also DID didn't cope with the above, in particular if the server changed name - Fixed.
+
+
+09/03/2015
+Changes for version 2014:
+    - A DIM command could be discarded if the DNS connection went stale and the first attempt
+      to use it was to send a command. (Introduced a Keepalive between clients and the DNS)
+
 
 22/01/2014
Index: trunk/FACT++/dim/dim/dim.h
===================================================================
--- trunk/FACT++/dim/dim/dim.h	(revision 18097)
+++ trunk/FACT++/dim/dim/dim.h	(revision 18349)
@@ -14,5 +14,5 @@
 #include "dim_common.h"
 
-#define DIM_VERSION_NUMBER 2013
+#define DIM_VERSION_NUMBER 2015
 
 
Index: trunk/FACT++/dim/src/dic.c
===================================================================
--- trunk/FACT++/dim/src/dic.c	(revision 18097)
+++ trunk/FACT++/dim/src/dic.c	(revision 18349)
@@ -30,5 +30,4 @@
 
 #define BAD_CONN_TIMEOUT 2
-
 
 typedef struct bad_conn {
@@ -498,4 +497,5 @@
 		break;
 	case STA_CONN:        /* connection received */
+		dna_set_test_write(conn_id, 2*(dim_get_keepalive_timeout()));
 		if(Dns_dic_conn_id < 0)
 		{
@@ -549,4 +549,18 @@
 				size = 0;
 			(servp->user_routine)( &servp->tag, &size );
+		}
+		else
+		{
+			if((servp->pending == WAITING_DNS_UP) || (servp->pending == WAITING_DNS_ANSWER))
+			{
+				dim_print_date_time();
+				printf(" Client Sending Command: Command %s discarded, no DNS answer\n", servp->serv_name);
+				fflush(stdout);
+			}
+/*
+			else if(servp->pending == WAITING_SERVER_UP)
+			{
+			}
+*/
 		}
 		dic_release_service( (unsigned)servp->serv_id );
Index: trunk/FACT++/dim/src/did/did.c
===================================================================
--- trunk/FACT++/dim/src/did/did.c	(revision 18097)
+++ trunk/FACT++/dim/src/did/did.c	(revision 18349)
@@ -2341,8 +2341,13 @@
 	buffer->server.pid = vtohl(buffer->server.pid);
 	n_services = buffer->server.n_services;
-
+	/*
+printf("received pid %d, nservices %d\n",buffer->server.pid, n_services);
+	*/
 	if(n_services == 1)
 	  return;
 	strcpy(sname, buffer->server.task);
+	/*
+printf("name = %s\n", sname);
+	*/
 	if(n_services > 1)
 	{
@@ -2410,4 +2415,10 @@
 		}
 		servp->busy = 1;
+		if(strcmp(servp->name, sname))
+		{
+		  strcpy(servp->name,sname);
+		  Force_update = 1;
+		  servp->busy = 3;
+		}
 	}
 	else
@@ -2526,4 +2537,9 @@
 		}
 		server_ptr = &servp->server;
+		if(servp->busy == 3)
+		{
+		  remove_button(servp);
+		  servp->busy = 1;
+		}
 		if(servp->busy == 1)
 		{
Index: trunk/FACT++/dim/src/dis.c
===================================================================
--- trunk/FACT++/dim/src/dis.c	(revision 18097)
+++ trunk/FACT++/dim/src/dis.c	(revision 18349)
@@ -223,4 +223,5 @@
 	void dis_dns_init();
 
+	dim_init();
 	dis_dns_init();
 	{
Index: trunk/FACT++/dim/src/examples/test_server.cxx
===================================================================
--- trunk/FACT++/dim/src/examples/test_server.cxx	(revision 18097)
+++ trunk/FACT++/dim/src/examples/test_server.cxx	(revision 18349)
@@ -142,10 +142,9 @@
 		newDns = new DimServerDns(extraDns, 0, (char *)"new_TEST");
 
-/*
-	int i, arr[15000];
-	DimService *servp;
-	DimCommand *cmndp;
-	char str[132];
-*/
+//	int i, arr[15000];
+//	DimService *servp;
+//	DimCommand *cmndp;
+//	char str[132];
+
 //	float farr[4];
 //	DimService *farrp;
@@ -173,31 +172,30 @@
 
 
-/*
 //	DimServer::autoStartOff();
-	DimServer::start("TEST");
-
-	for(i = 0; i < 15000; i++)
-	{
-		arr[i] = i;
-		sprintf(str,"ServiceManyTest/%05d",i);
-		servp = new DimService(str,arr[i]);
-		servp->setQuality(1);
-		servp->updateService(arr[i]);
 //	DimServer::start("TEST");
-		sprintf(str,"CommandManyTest/%05d",i);
-		cmndp = new CmndServMany(str);
-//	DimServer::start("TEST");
-	}
-*/
+
+//	for(i = 0; i < 15000; i++)
+//	{
+//		arr[i] = i;
+//		sprintf(str,"ServiceManyTest/%05d",i);
+//		servp = new DimService(str,arr[i]);
+//		servp->setQuality(1);
+//		servp->updateService(arr[i]);
+////	DimServer::start("TEST");
+//		sprintf(str,"CommandManyTest/%05d",i);
+//		cmndp = new CmndServMany(str);
+////	DimServer::start("TEST");
+//	}
+
 	while(1)
 	{
 		sleep(5);
-/*
-		while(cmdsvr.hasNext())
-		{
-			cmdsvr.getNext();
-			cmdsvr.handleIt();
-		}
-*/
+
+//		while(cmdsvr.hasNext())
+//		{
+//			cmdsvr.getNext();
+//			cmdsvr.handleIt();
+//		}
+
 		s1 = "hello1";
 		if(!boolval)
@@ -217,2 +215,19 @@
 }
 
+/*
+int main()
+{
+DimService *servint, *newServint;
+int ival = 0;
+
+DimServer::start("TEST");
+servint = new DimService("TEST/INTVAL",ival);
+sleep(20);
+DimServer::stop();
+sleep(1);
+DimServer::start("TESTOTHER");
+newServint = new DimService("TESTOTHER/INTVAL",ival);
+sleep(20);
+DimServer::stop();
+}
+*/
