[Interest] Qt signal when system is awakened

Tony Rietwyk tony at rightsoft.com.au
Thu Jul 25 02:34:09 CEST 2013


Shawn wrote: 

> Sent: Wednesday, 24 July 2013 4:44 PM
> 
> On 24 Jul 2013, at 7:16 AM, Tony Rietwyk wrote:
> 
> > Hi Everybody,
> >
> > My application connects to cloud servers and obtains a session id used
in
> > subsequent interactions.  Some clients are using the app on laptops.
They
> > rarely shutdown their system, and just close the lid, which puts the OS
> > (Windows or OSX) to sleep.   Hours or days later, they open the lid and
see
> > my app still running.  They perform some actions, then get an error when
> the
> > app tries to continue the session with the cloud server.   I have
> > temporarily increased the timeouts in the cloud service, but that is
> > not very satisfactory.
> 
> Don't you need to fail/retry gracefully when sessions expire anyway?  e.g.
if
> the server is restarted while users are connected, the user's net
connection
> goes down, etc.  Are you using Qt network or cloud features which do not
> handle this satisfactorily?  Is it a TCP session which takes too long to
time out,
> or are you disconnecting between transactions already?  Is there a reason
> your cloud service cannot be RESTful?

I wanted to avoid keeping the password in memory after the login process.
Popping up the login dialog on the client at the point where they try to
communicate is really messy.   But I suppose it is just as messy, doing that
when the awaken occurs.  I'll try keeping the password, and attempting a
silent reconnect.  

> > Is there a Qt signal when the system state changes to or from sleep or
> > hibernate?
> 
> Not that I know of, but it sounds like a good idea.  Mobile applications
> typically have OS-managed life cycles, so recently we've added
> Qt::ApplicationStates and ApplicationStateChangeEvent.  (OS X also has
auto
> saving and restoring of documents and sessions, which I don't know a lot
> about yet, but I wonder if it tries to do an auto-save before sleeping.)
But
> I'm not sure yet if we could guarantee on every platform that applications
> would see a state change when the system sleeps or wakes.  It seems like a
> good goal to try to achieve.
> 
> (see https://codereview.qt-project.org/#change,51904 and related patches)
> 
> Maybe it should also be a property of the QSessionManager.
> 
> I wrote up this idea here so we don't forget about it:
> 
> https://bugreports.qt-project.org/browse/QTBUG-32597

Thanks for that Shawn.  

Regards, 

Tony




More information about the Interest mailing list