connection troubles

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

connection troubles

Waldemar Schwan-2
Hello everyone. Youre where a great help so far enabling me to push my work further. Thanks a lot for that.

I have some connection troubles since I created my own Harness and made some changed to CroquetMaster. Sometimes I get an MessageNotUnterstand-Error


occuring in 

"Act as a server, e.g., a participant trusted to replicate an island."
| joinFacet serveFacet |
"Revoke the prior #recv/serve facets"
serveFacet := facets at: #serve ifAbsent:[nil].
serveFacet ifNotNil:[self revokeMessageFacet: serveFacet].

"Create a new #serve facet"
serveFacet := self addMessageFacet: #serve:from:.
facets at: #serve put: serveFacet.

joinFacet := facets at: #beServer.
connection outQueue nextPut: (TDatagram facet: joinFacet data: serveFacet).

I spend 3 days searching for the reasion, but because its happening randomliy, I'm completly stumbed.

My changed to CroquetMaster where: 

"harness := CroquetHarness new."
harness := CBHarness new.
[harness setupMaster.]
on: CBLoginError
do: [ :err |
Transcript show: err; cr.
self delete.
harness addOverlay: self.

| sync world worldSpace wpc portalToLib toLibPostcard |

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"

lib := self createIsland: CBLibrary named: 'Library'.
libSpace := lib future at: #libSpace.
portalToMyWorld := lib future at:#portalToMyWorld.

lpc := libSpace future postcard.
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.
"@@@@ FIXME: This is clearly not the way to do it @@@@"
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."

It whould be realy great if someone could give me a hint where to lock at, or explain whats going on behind the scenes.