Changeset 2254:bacfcc1256ca for gozerbot/net/cloud.py
- Timestamp:
- 08/26/08 17:37:16 (4 months ago)
- Branch:
- default
- Files:
-
- 1 modified
-
gozerbot/net/cloud.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gozerbot/net/cloud.py
r2253 r2254 5 5 __copyright__ = 'this file is in the public domain' 6 6 7 from gozerbot.generic import rlog 7 from gozerbot.generic import rlog, whichmodule 8 8 from gozerbot.persiststate import PersistState 9 9 from gozerbot.net.client import Client … … 11 11 from gozerbot.thr import start_new_thread 12 12 from gozerbot.datadir import datadir 13 from gozerbot.net.server import server14 13 from gozerbot.contrib.simplejson import dumps 15 14 import asyncore, time, os … … 84 83 if persist: 85 84 self.persist(name, url) 86 rlog(10, 'net.cloud', 'added %s node <%s>' % (name, url))85 rlog(10, whichmodule(), 'added %s node <%s>' % (name, url)) 87 86 return self.nodes[url] 88 87 89 def start(self ):90 self.boot( )88 def start(self, booturl=None): 89 self.boot(booturl) 91 90 for name, url in self.startup['start'].iteritems(): 92 91 self.add(name, url) 93 self.joinall() 94 92 95 93 def persist(self, name, url): 96 94 self.startup.set('start', name, url) … … 159 157 client = Client("%s/gozernet/+join/" % url).addcb(cb) 160 158 else: 161 client = Client('http:// 213.196.7.59:10101/gozernet/+join/').addcb(cb)159 client = Client('http://gozerbot.org:10101/gozernet/+join/').addcb(cb) 162 160 client.add(name=name, port=port) 163 164 def joinall(self):165 for item in self.nodes.values():166 self.join(item.url)167 start_new_thread(asyncore.loop, (), {'use_poll': True })168 161 169 162 def boot(self, node=None): … … 186 179 def cb(client, result): 187 180 if result.error: 188 rlog(10, self.url, "can't sync: %s" % result.error)181 rlog(10, url, "can't sync: %s" % result.error) 189 182 return 190 183 for node in result.data:
