I spend 3 days searching for the reasion, but because its happening randomliy, I'm completly stumbed.
setupMaster
| sync world worldSpace wpc portalToLib toLibPostcard |
"MyWorld"
world := self createIsland: CBMyWorld named: 'Master'.
worldSpace := world future at: #masterSpace.
portalToLib := world future at: #portalToLib.
wpc := worldSpace future postcard.
toLibPostcard := portalToLib future postcard.
wpc whenResolved:[
self addIsland: world postcard: wpc value.
sync := viewPortal future postcardLink: wpc value.
sync whenResolved:[doRender := true]. "ready to render"
].
"Library"
"
lib := self createIsland: CBLibrary named: 'Library'.
libSpace := lib future at: #libSpace.
portalToMyWorld := lib future at:#portalToMyWorld.
lpc := libSpace future postcard.
lpc.
toMyWorldPostcard := portalToMyWorld future postcard.
toLibPostcard whenResolved: [
toMyWorldPostcard whenResolved: [
self addIsland: lib postcard: toMyWorldPostcard value.
portalToMyWorld future postcardLink: toLibPostcard value.
portalToLib future postcardLink: toMyWorldPostcard value.].].
"
createIsland: islandClass named: aString
"Create a new island. islandClass must be a class that is used to generate the contents of the TIsland. aString is a name for the router/island that allows another user to identify it. aBlock is executed upon completion and existence of the island. This is used to do additional setup with the island."
| p router controller id userController island space |
userController := CBUserController uniqueInstance.
id := islandClass islandID.
"if a controller for this island has already been registered, just use that"
allowControllerAliasing ifTrue:[
controller := controllers detect:[:cc| cc sessionID = id and:[cc island == nil]] ifNone:[nil].
controller ifNotNil:[^self createIsland: islandClass named: aString using: controller].
].
"Create the dispatcher for any local islands we'd like to host the router for"
dispatcher ifNil:[
dispatcher := TExampleDispatcher new.
dispatcher listenOn: 0. "wildcard port"
dispatcher autoCreate: false.
].
" <at> <at> <at> <at> FIXME: This is clearly not the way to do it <at> <at> <at> <at> "
router := CBRouter new.
false ifTrue:[router log: Transcript].
router addUser: userController localUser.
dispatcher addRouter: router id: id.
contactPoint ifNil:[contactPoint := TContactPoint new].
contactPoint addBroadcast:(TContact new
address: dispatcher address port: dispatcher port
id: id name: aString).
"Create the controller"
controller := CBIslandController new.
controller connectTo: dispatcher address port: dispatcher port sessionID: id.
self addController: controller.
p := controller login: userController localUser.
"p := controller login: 'bla' password: 'blub'."
p wait.
p result ifFalse: [ CBLoginError signal].
p := controller join. "receive messages"
p wait. "see above"
controller backDoor: (dispatcher routers at: id).
island := self createIsland: islandClass named: aString using: controller.
"space := island future at: #masterSpace."
"CBAccessController grantReadToAllIn: space."
^island
It whould be realy great if someone could give me a hint where to lock at, or explain whats going on behind the scenes.
Regards
Waldemar