You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once a client sends a QUIT-message, it's important that said message should be send to each client, that shares at least one channel with the quitting client, exactly once.
The algorithm for doing this, is going to be something in the line of:
q := QuittingClient
n := ClientSet // Set of client's that has already been notified.
for each channel that q is in:
for each client in channel:
if not n.Contains(client):
client.Quit(q) // Let client know that q QUIT.
n.Insert(client)
The text was updated successfully, but these errors were encountered:
I'd build a notifier-set of clients that should be notified by querying each channel the client is on currently. Of course adding an already present notifier to this set is a no-op. After I have this set, i'll simply post the quit to each one in it.
It is the transpose of your implementation. It may be easier:
q := QuittingClient
n := ClientSet
for each ch q is in:
n.AddMembers(channel.Members())
for e in n:
e.Quit(q)
Once a client sends a QUIT-message, it's important that said message should be send to each client, that shares at least one channel with the quitting client, exactly once.
The algorithm for doing this, is going to be something in the line of:
q := QuittingClient
n := ClientSet // Set of client's that has already been notified.
for each channel that q is in:
for each client in channel:
if not n.Contains(client):
client.Quit(q) // Let client know that q QUIT.
n.Insert(client)
The text was updated successfully, but these errors were encountered: