Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Quit should notify channel members. #13

Open
ahf opened this issue May 25, 2011 · 1 comment
Open

Client Quit should notify channel members. #13

ahf opened this issue May 25, 2011 · 1 comment
Labels

Comments

@ahf
Copy link
Owner

ahf commented May 25, 2011

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)

@jlouis
Copy link

jlouis commented May 25, 2011

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants