diff mcserver/mcserver.py @ 33:fe04ff3547c7

added more sophisticated testing
author gyorgyf
date Tue, 09 Jul 2013 16:30:47 +0100
parents cb57e554ae80
children 4455a77435b0 c0b34039917a
line wrap: on
line diff
--- a/mcserver/mcserver.py	Tue Jul 09 16:20:08 2013 +0100
+++ b/mcserver/mcserver.py	Tue Jul 09 16:30:47 2013 +0100
@@ -67,8 +67,14 @@
 	# 	return str()
 	
 	@cp.expose
+	def test(self):
+		print "Server test function accessed."
+		cp.log.error("Server test function accessed.")
+		return "Server: Test passed."
+	
+	@cp.expose
 	def mood(self,x,y):
-		print "Received coordinates", x,y, "\n"
+		print "Received coordinates", x,y
 		i = Input(x,y,self.age,self.dist)
 		if i in self.inputs :
 			self.inputs[self.inputs.index(i)].inc()
@@ -114,7 +120,7 @@
 	result = w.stdout.readlines()
 	exitcode = w.wait()
 	if not result : 
-		print "getProcessPid:: Unable to obtain process pid. (lsof returned nothing. exitcode: %s)" %str(exitcode)
+		print "getProcessPid:: Unable to obtain process pid. (lsof returned nothing. exitcode: %s) This is fine in most cases..." %str(exitcode)
 		return False
 	import pprint
 	pprint.pprint(result)
@@ -172,6 +178,7 @@
 	ip = cp.server.socket_host
 	print "Trying to bind: %(ip)s:%(port)s" %locals()
 	getProcessPids(port,kill=True)
+	print "Starting..."
 	cp.quickstart()
 
 if __name__ == "__main__":