tsp/xbmc — pull request #23 by idekker (2012-06-02 12:53:56+00:00)
Title: Allowing for reconnecting to control, event and database connection when they got lost

I've extended libcmyth with some functions to reconnect a cmyth_conn_t structure without having to rebuild the whole structure. The cmyth_conn_t structure now stores server and port information.
Currently, I misuse conn_hang for disconnected socket connections (for errors like 'connection reset by peer'), maybe this should change sometime.

For the mythtv addon I've created simple macro's to call CMYTH functions with automatic reconnecting and re-calling the function if needed. It is assumed that reconnecting is possible, so it is only tried once for every command. After 10 retries (so for different commands) it will not try again... on every successful reconnect, the retry counter is reset, so it will still work after going to standby 10 times.
I'm not quite sure reconnecting works properly on MythEventHandler, but there should be no regression. I will test that part some more and might require another commit.
Also I had some troubles with getting Live TV to work after standby, but I'm not quite sure this is because of disconnected control connections. Although I do see that some of those cmyth_conn_t structures are hidden inside other structures (so hidden from xbmc perspective). They might need some more API changes on libcmyth side.

I basically did the same for the myth:// protocol code.