def sendComm(self, hostname, port, msg_type, config_data):
try:
self.sock.connect((hostname, port))
- self.sendMsg(msg_type)
+ self.sendMsg(pickle.dumps((msg_type, config_data)))
response = self.recvMsg()
- if response == ACK_MSG:
- self.sendMsg(pickle.dumps(config_data))
- response = self.recvMsg()
- print "->>>>>>>>>>>>>>>>>>>>>>>>>", response
+ return response
except Exception, e:
+ print "Ups: Could not complete request"
print e
finally:
self.sock.close()
def startDaemon(self, node):
print node.daemon_dir
- comm = "python " + node.daemon_dir + "Server.py start " + node.public_address + " " + node.listen_port
+ comm = SERVER_TYPE+ " "+SERVER_DIR+ " "+SERVER_FILE+" "+"start"
+ #+ node.public_address + " " + node.listen_port
print comm
#self.printDummyCommand(node.public_address, node.public_port, node.ssh_port, comm)
- self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), comm)
- self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), "ps -ef | grep Server")
+ #self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), comm)
+ #self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), "ps -ef | grep Server")
def applyTC(self, node):
si = self.swarm.getSIByNode(node)
- self.tc.config(node.public_address, node.public_port, node.public_iface, \
- node.private_address, node.private_port, node.private_iface)
+ self.tc.config(node.public_address,
+ node.public_port,
+ node.public_iface,
+ node.private_address,
+ node.private_port,
+ node.private_iface)
self.tc.set_upload_limit(si.upload_limit)
self.tc.set_download_limit(si.download_limit)
commands = self.tc.get_all_commands()
- self.printDummyCommand(node.public_address, node.public_port, node.ssh_port, commands)
+ #self.printDummyCommand(node.public_address, node.public_port, node.ssh_port, commands)
#sendMultipleSSHComm(node.public_address, node.username, node.ssh_port, commands)
def sendSIStart(self, si):
TORRENT : torrent_file }
self.printDummyCommand(node.public_address, node.listen_port, START_MSG, config_data)
- self.sendComm(node.public_address, int(node.listen_port), START_MSG, config_data)
+ response = self.sendComm(node.public_address,
+ int(node.listen_port),
+ START_MSG,
+ config_data)
+ switch(a):
def printDummyCommand(self, public_address, public_port, option1, data):
print "----------------------"