Changeset - 7b737e64c6a0
[Not reviewed]
default
0 1 0
Laman - 8 years ago 2017-06-12 21:31:59

actually using host and port command line parameters
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general) First comment
src/morevna.py
Show inline comments
 
@@ -2,6 +2,7 @@ import sys
 
import os.path
 
from argparse import ArgumentParser
 

	
 
import config as conf
 
from hashtree import HashTree
 
from client import Client
 
from server import Server
 
@@ -21,6 +22,8 @@ def buildTree(args):
 

	
 
def update(args):
 
	_checkFile(args.datafile)
 
	if args.host: conf.hosts.insert(0,args.host)
 
	if args.port: conf.port=args.port
 

	
 
	c=Client(args.datafile)
 
	blocksToTransfer=c.negotiate()
 
@@ -30,6 +33,8 @@ def serve(args):
 
	_checkFile(args.datafile)
 
	if args.tree:
 
		_checkFile(args.tree)
 
	if args.host: conf.hosts.insert(0,args.host)
 
	if args.port: conf.port=args.port
 

	
 
	# debug copy default file
 
	import shutil
 
@@ -52,7 +57,6 @@ pBuild.set_defaults(func=buildTree)
 
pUpdate=subparsers.add_parser("update")
 
pUpdate.add_argument("-p","--port",type=int)
 
pUpdate.add_argument("--host",default="127.0.0.1")
 
pUpdate.add_argument("-t","--tree",help="stored hash tree location")
 
pUpdate.add_argument("datafile")
 
pUpdate.set_defaults(func=update)
 

	
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now