grke/burp — pull request #138 by ZungBang (2013-01-29 00:14:16+00:00)
Title: win32: prevent system from entering sleep when idle timer expires

Backup and other long running operations may be interrupted by the client machine entering sleep when the idle timer expires.

I've seen this happen on two windows 7 laptops: during backup, the client machine goes to sleep, and the burp server does not notice this for a long while. Eventually, the burp server will report this as "client crashed" while the burp client aborts the operation on its side as soon the client machine wakes up.

The fix is to use the [``SetThreadExecutionState``](http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208%28v=vs.85%29.aspx) Windows API to prevent sleep before any operation starts, and allow sleep after the client is done.

Please review and pull.