[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Ping servers by hostname; fix default userdir location



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv15606/lib/mixminion

Modified Files:
	ClientMain.py 
Log Message:
Ping servers by hostname; fix default userdir location

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- ClientMain.py	3 Jan 2004 07:35:23 -0000	1.146
+++ ClientMain.py	4 Jan 2004 02:46:28 -0000	1.147
@@ -144,10 +144,7 @@
     LOG.warn("No configuration file found. Installing default file in %s",
                   fname)
 
-    fields = { 'ud_default' : '~/.mixminion' }
-
-    if sys.platform == 'win32':
-        fields['ud_default'] = 'mixminion'
+    fields = { 'ud_default' : mixminion.Config.DEFAULT_USER_DIR }
 
     writeFile(os.path.expanduser(fname),
               """\
@@ -1232,13 +1229,30 @@
     client = parser.client
 
     for arg in args:
-        info = directory.getServerInfo(arg,
+        if '.' in arg:
+            addrport = arg.split(":",1)
+            if len(addrport) == 2:
+                try:
+                    port = int(addrport[1])
+                except ValueError:
+                    raise UIError("Invalid port: %r"%addrport[1])
+                
+            else:
+                arg = "%s:48099"%arg
+                port = 48099
+            addr = addrport[0]
+            routing = mixminion.Packet.MMTPHostInfo(addr,port,"\x00"*20)
+            name = arg
+        else:
+            info = directory.getServerInfo(arg,
                                        startAt=time.time(), endAt=time.time(),
                                        strict=1)
+            routing = info.getRoutingInfo()
+            name = info.getNickname()
 
-        ok, status = client.pingServer(info.getRoutingInfo())
+        ok, status = client.pingServer(routing)
         print ">>>", status
-        print info.getNickname(), (ok and "is up" or "is down")
+        print name, (ok and "is up" or "is down")
 
 _IMPORT_SERVER_USAGE = """\
 Usage: %(cmd)s [options] <filename> ...