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

Issue with disconnecting #4

Open
mlapaglia opened this issue Apr 17, 2013 · 3 comments
Open

Issue with disconnecting #4

mlapaglia opened this issue Apr 17, 2013 · 3 comments

Comments

@mlapaglia
Copy link

                try
                {
                    while (_Connection.IsConnected &&
                           ((data = _Connection._Reader.ReadLine()) != null))
                    {
                        _Queue.Enqueue(data);
                        QueuedEvent.Set();
                    }
                }

I'm having some problems with this portion of the code. When I am telling the IRC bot to Disconnect(), it is hanging at _Thread.Join() until the ReadLine() goes through the loop (when it receives another message in a channel or anything that causes ReadLine() to have data), at which time it catches the Abort() call.

This is causing me problems with the bot hanging after I tell it to disconnect, it won't actually disconnect until something is first received.

Am I doing something wrong here?

@meebey
Copy link
Owner

meebey commented Jul 25, 2013

Looks like the socket has to be closed else it blocks inside StreamReader.ReadLine() despite of the thread abort. This issue does NOT happen on Mono, just MS .NET. Their threading implemention seems to be more flaky I guess... Nonetheless SmartIrc4net should use that workaround for the people on the dark side of the forces... Also see:
http://stackoverflow.com/questions/2370534/threadabort-not-working-with-readline-from-a-socket

@Cyberboss
Copy link

A work around for this I've found is to always use RfcQuit before disconnecting, this speeds things up significantly.

@No3371
Copy link

No3371 commented Jul 9, 2021

This happens on Unity so I guess it happens on Mono.
If we disconnect without logging out, the whole app freeze for ThreadAbortException, this is... acceptable.
But if our IRC server is closed accidentally, all the clients app will just all freeze .

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

No branches or pull requests

4 participants