Permalink
Browse files

- C Makefile

- Examples renamed
  • Loading branch information...
1 parent 6cf17ef commit 5fbc96cd637be46e50868e7ae861f1f0a0f864d3 @rep committed May 3, 2011
View
@@ -0,0 +1,10 @@
+# Set the filename
+FILE = client
+
+cpwrcli: $(FILE).c
+ gcc -lssl -lmsgpack -g -o cpwrcli $(FILE).c
+
+# Target clean
+clean:
+ rm cpwrcli
+
@@ -36,7 +36,7 @@ def connclosed(reason):
rc._on('close', connclosed)
def main():
- n = Node(cert='instamaster.pem')
+ n = Node(cert='serverside.pem')
im = Instamaster()
ref = n.register_object(im, 'im')
n._on('connection', im.on_new_conn)
@@ -15,6 +15,7 @@
MASTERURL = 'pwrcall://c6db6fac64dd58e7a7a8228e9bc11116397ba58d@137.226.161.210:20001/im'
MASTERURL = 'pwrcall://e7bcae69e9c79aad2f4b8fe1f14bcd52beb4faae@137.226.161.211:20001/im'
DOTPATH = os.path.expanduser('~/.instashare/')
+CERTPATH = os.path.join(DOTPATH, 'cert.pem')
class File(object):
def __init__(self, fname):
@@ -143,7 +144,7 @@ def opts():
return options, action, args
def main(options, action, args):
- n = Node(cert=os.path.join(DOTPATH, 'cert.pem'))
+ n = Node(cert=CERTPATH)
if action == 'listen':
ic = Instaclient(n)
@@ -193,12 +194,11 @@ def setup_dotdir():
except:
return False
- certpath = os.path.join(DOTPATH, 'cert.pem')
- if not (os.path.exists(certpath) and os.path.isfile(certpath)):
+ if not (os.path.exists(CERTPATH) and os.path.isfile(CERTPATH)):
print 'Generating self-signed certificate...'
try:
crt = gen_selfsigned_cert()
- open(certpath, 'w').write(crt)
+ open(CERTPATH, 'w').write(crt)
except:
return False
@@ -35,7 +35,7 @@ def resultcb(self, result):
class Master(object):
def __init__(self):
- self.n = Node(cert='cert.pem')
+ self.n = Node(cert='serverside.pem')
self.n.listen(port=10000)
ref = self.n.register_object(self, 'master')
print 'Master at', self.n.refurl(ref)
@@ -1,7 +1,7 @@
import sys
from pwrcall import loop, unloop, Node, expose
-n = Node(cert='cert.pem')
+n = Node(cert='clientside.pem')
math = n.establish(sys.argv[1])
#math2 = n.connect('127.0.0.1', 10000).rootobj().call('get', sys.argv[1].split('/')[-1])
@@ -12,7 +12,7 @@ def add(self, a, b):
def mul(self, a, b):
return a*b
-n = Node(cert='cert2.pem')
+n = Node(cert='serverside.pem')
ref = n.register_object(Math())
n.listen(port=10000)
print 'math obj ready at', n.refurl(ref)
@@ -18,7 +18,7 @@ def fulfill():
later(2.0, fulfill)
return p
-n = Node(cert='cert2.pem')
+n = Node(cert='clientside.pem')
s = Slave()
m = n.establish(sys.argv[1])
m.call('addslave', s)

0 comments on commit 5fbc96c

Please sign in to comment.