[Box Backup-commit] COMMIT r1577 - box/chris/merge/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Apr 22 21:48:18 BST 2007


Author: chris
Date: 2007-04-22 21:48:18 +0100 (Sun, 22 Apr 2007)
New Revision: 1577

Modified:
   box/chris/merge/lib/server/ServerStream.h
Log:
Ignore attempts to listen on a Unix socket on Win32, so that we can share
config files for the unit tests (refs #3)


Modified: box/chris/merge/lib/server/ServerStream.h
===================================================================
--- box/chris/merge/lib/server/ServerStream.h	2007-04-22 20:47:24 UTC (rev 1576)
+++ box/chris/merge/lib/server/ServerStream.h	2007-04-22 20:48:18 UTC (rev 1577)
@@ -170,16 +170,22 @@
 						}
 						else if(c[0] == "unix")
 						{
-							// Check arguments size
-							if(c.size() != 2)
-							{
-								THROW_EXCEPTION(ServerException, ServerStreamBadListenAddrs)
-							}
+							#ifdef WIN32
+								BOX_WARNING("Ignoring request to listen on a Unix socket on Windows: " << addrlist[a]);
+								delete psocket;
+								psocket = NULL;
+							#else
+								// Check arguments size
+								if(c.size() != 2)
+								{
+									THROW_EXCEPTION(ServerException, ServerStreamBadListenAddrs)
+								}
 
-							// unlink anything there
-							::unlink(c[1].c_str());
-							
-							psocket->Listen(Socket::TypeUNIX, c[1].c_str());
+								// unlink anything there
+								::unlink(c[1].c_str());
+								
+								psocket->Listen(Socket::TypeUNIX, c[1].c_str());
+							#endif // WIN32
 						}
 						else
 						{
@@ -187,8 +193,11 @@
 							THROW_EXCEPTION(ServerException, ServerStreamBadListenAddrs)
 						}
 						
-						// Add to list of sockets
-						mSockets.push_back(psocket);
+						if (psocket != NULL)
+						{
+							// Add to list of sockets
+							mSockets.push_back(psocket);
+						}
 					}
 					catch(...)
 					{
@@ -196,8 +205,11 @@
 						throw;
 					}
 
-					// Add to the list of things to wait on
-					connectionWait.Add(psocket);
+					if (psocket != NULL)
+					{
+						// Add to the list of things to wait on
+						connectionWait.Add(psocket);
+					}
 				}
 			}
 	




More information about the Boxbackup-commit mailing list