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

Handle deconnections in idle mode #35

Open
eonpatapon opened this issue Dec 31, 2012 · 5 comments
Open

Handle deconnections in idle mode #35

eonpatapon opened this issue Dec 31, 2012 · 5 comments

Comments

@eonpatapon
Copy link
Owner

The polling mode was handling network deconnections but with the idle method mpDris2 does not detect if the connection is lost.

Anyway mpDris2 does not crash on network deconection/reconnection and when network is back an event is sent on the socket so mpDris2 state is updated.

It would be nicer to detect that the network is gone and then release the dbus name close the socket connection etc...

@grawity
Copy link
Collaborator

grawity commented Dec 31, 2012

Wouldn't the 15-second-poll which I had left in idle mode have handled this?

(Or are you suggesting to watch NetworkManager state instead?)

@eonpatapon
Copy link
Owner Author

Well yes the 15s poll I've removed might be necessary to handle this case

I opened an issue to see if you have a better idea to handle this. I don't think relying on NM is a good idea though

@eonpatapon
Copy link
Owner Author

Was thinking that maybe the case if event & gobject.IO_HUP: would be triggered in case of network deconnection but it's not the case here

grawity added a commit that referenced this issue Dec 31, 2012
Keep polling for now, to detect connection loss during idle (issue #35).
Maybe a better solution will be found in the future.
@grawity
Copy link
Collaborator

grawity commented Dec 31, 2012

What kind of disconnection, specifically?

IO_HUP can be only triggered when the OS itself notices the connection
being lost. If the physical link goes down, it can take a while for the TCP
connection to time out... to make it somewhat faster, polling is needed
again.

On Mon, Dec 31, 2012 at 12:59 PM, Jean-Philippe Braun <
notifications@github.com> wrote:

Was thinking that maybe the case if event & gobject.IO_HUP: would be
triggered in case of network deconnection but it's not the case here


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-11775756.

Mantas Mikulėnas

@eonpatapon
Copy link
Owner Author

Works for real now, but the log is strange:

2013-01-02 19:08:47,352 mpDris2 DEBUG: Entered idle
2013-01-02 19:09:01,736 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,739 mpDris2 ERROR: Could not connect to MPD: [Errno 101] Network is unreachable
2013-01-02 19:09:01,740 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,740 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,743 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,743 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,746 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,746 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,748 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,748 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,751 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,751 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,754 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,755 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,758 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,759 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,759 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,760 mpDris2 WARNING: Disconnected
2013-01-02 19:09:01,760 mpDris2 DEBUG: Sending command 'currentsong' (during idle? False)
2013-01-02 19:09:01,761 mpDris2 WARNING: Disconnected
2013-01-02 19:09:07,322 mpDris2 ERROR: Could not connect to MPD: [Errno 101] Network is unreachable
2013-01-02 19:09:12,322 mpDris2 ERROR: Could not connect to MPD: [Errno 101] Network is unreachable
2013-01-02 19:09:17,321 mpDris2 ERROR: Could not connect to MPD: [Errno 101] Network is unreachable
2013-01-02 19:09:22,321 mpDris2 ERROR: Could not connect to MPD: [Errno 101] Network is unreachable
2013-01-02 19:09:27,317 mpDris2 INFO: Continue to connect but going silent

I don't know why the multiple "Disconnected" messages and currentsong calls...

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

2 participants