zerowidth / camper_van

A Campfire to IRC bridge
MIT License
129 stars 25 forks source link

Users still present on campfire after quitting #46

Closed dividedmind closed 10 years ago

dividedmind commented 11 years ago

Hi! CamperVan is great, but since I began using it people started to complain they can't ever tell if I'm online or not. When I quit IRC, a ghost of me stays on campfire and doesn't seem to go away ever.

dividedmind commented 11 years ago

The possible cause is at https://github.com/zerowidth/camper_van/blob/master/lib/camper_van/channel.rb#L90 - HttpClient#close doesn't really close the connection (cf. https://github.com/igrigorik/em-http-request/issues/244 ). I'm not sure what the right solution is.

janpio commented 10 years ago

Hm, I just tested this and could definitely reproduce it.

But then I tested with a browser and there I also stayed in the channel as a ghost. Only when I clicked the leave button in the Campfire interface was I instantly removed from the room.

Tomorrow morning I'll know how long it took to 'time out' for the ghost.

janpio commented 10 years ago

Here is the information how long it takes for the normal web version to 'timeout':

Try 1: [12:10:59] --> [12:30:10] Try 2: [12:33:37] --> [12:50:12]

It's between 15 and 20 minutes. That's much longer than I expected.

Now let's try what happens when I close the connection in my IRC client, and what happens when I just kill camper_van. Will be reporting back...

janpio commented 10 years ago

I tested with my local installation and saw that the user never really left. Sometimes it would time out, sometimes not. I couldn't find the reason for that.

Your link to channel.rb then showed me that the implementation is counting on a timeout that maybe doesn't work all the time. I commented out line 93 and tried again, this time an explicit PART/leave for the channel removed me from the channel user list. So changing your installation could at least solve that problem.

But normally you don't PART/leave the channel, but just close the connection to your IRC server. I already had noticed strange things with disconnecting before and had created #47. I think this is connected. If there was explicit handling of the disconnect like leaving channels, you also shouldn't be there as a ghost any more.

zerowidth commented 10 years ago

Alright, I made the part explicit instead of relying on a timeout. Should prevent any problems with ghost uers &c.