AltME: R3 Protocols

Messages

Rebolek
It's bit messy...
GrahamC
yeah ..
you have
port: event/port
but then still do write event/port
Rebolek
yes, but it shouldn't be problem, no? It's copypasted from two different versions...
GrahamC
It looks good to me .. but I only just woke up
Rebolek
It prints "Read 5 bytes" and then waits until timeout. [Return true] is there so I guess it should work. But it doesn't :/
GrahamC
why are you not using the port returned by 'open?
Rebolek
you mean like [rp: open rp]  ?
I copied that code from the example on rebol.net
GrahamC
you return the newly opened port .. so I thought you'd use it ?
Andreas
Bolek, you don't install an awake handler on the TCP subport.
In line 400, you explicitly clear the awake handler on the TCP subport:
https://github.com/rebolek/prot-redis/blob/master/prot-redis.r3#L400
So I don't think the awake handler you install on the Redis parent port (the example you pasted above) will be called at all.
GrahamC
so, you need to get the port returned by open and install the async handler on that
Andreas
Right.
GrahamC
I was getting there ... heh
Rebolek
But  READ in ASYNC-HANDLER gets called.
Andreas
Are you absolutely sure about that?
Rebolek
I changed the line 400 to [tcp-port/awake: :redis-port/awake] and it's still the same.
Andreas: PRINT prints in console, so I guess it should.
Andreas
And it prints even without setting the subport's awake?
GrahamC
rp: open redis://192.168.2.11:10
rp/awake: :async-handler
write rp [ SET asynctest true ]
wait [ rp 3 ]

Last message posted 489 weeks ago.