Hello everyone!
I have a server that will use Time.repeat to send a signal to a couple
of clients every two seconds. It looks something like this:
class ServerClass from Discovery.server Time.repeat
prop locking
attr peers
...
meth register(Peer)
%% A client registers himself by sending a ticket
lock peers := {Connection.take Peer}|@peers end
end
meth deregister(Peer)
lock peers := {List.subtract @peers Peer} end
end
meth broadcast(Message)
{ForAll @peers
proc {$ Peer}
try {Peer Message}
catch _ then {self deregister(Peer)} end
end}
end
...
end
In other words: it maintains a list of Connections (which are really
taken tickets from stationary objects built with MakeStat resp. NewStat)
and can broadcast to them. One of these broadcasts is (as mentioned) one
that will take place every 2 seconds. It has a zero-tolerance policy,
which means, if there is any trouble (= exception) with the connection,
he throws the Peer out of the list.
The clients can't be trusted. It could be that they crash. So I tested
what happens when I hit CTRL-C every now and then on the client side. It
turns out that sometimes the server will tell me (I inserted some
logging stuff to see what's happening) that he threw out a misbehaving
client and just continues with sending the Messages to the other clients
(as he should). But sometimes it just blocks and doesn't do anything
anymore if I kill one of the clients.
What can I do to make this more stable?
All the best,
Jens Grabarske
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users