mherger wrote: 
> I'm sorry guys, didn't have time to keep up with the discussion in a 
> timely manner... is there any conclusion in what the issue is, what to
> fix?

Good timing.   I spent a good bit of time yesterday on this and SF
co-operated by delivering a really bad download speed.

As I see the issue, the PluginDownload and Extensions Plugin were
written by Triode who wrote big chunks of LMS, Squeezeplay and all of
Squeezelite. 
Triode wrote v. good, clever code and the facility has worked OK for
many years. I think only smallish ZIP files were anticipated  - probably
LocalPLayer. 
AlienBBC was one of his plugins, it relied on MPlayer executable but the
plugin downloaded the executable - it was not part of the ZIP

So I see the current problem as arising from changes since Triode was
last on-line.
The main changes:
- Huge plugin files - 10's of MegaBytes not 100's of kBytes
- Unreliable Respository performance - On my 300mbits link,  SF can
deliver the RAOPbridge exe anything between 1.7sec and 30mins !
- faster LMS processors

After looking at the code - with one exception I think it is working as
designed
- Once Download has started (i.e. shortly after Apply button press) a
"Restart Now Restart later" message box is displayed 
- It was expected download would be complete within seconds.
- After Clicking "Restart Now "  - 2secs delay is applied before restart
happens.
- when download is complete,  sha is checked.  (There is some sort of
file size check but not certain what happens if file size is not
correct)
- There is a Download timer which checks once per seconds to see if
Download is complete until MAX_DOWNLOAD_WAIT - currently 20 secs.  Not
exactly sure what happens when counter expires.

The exception is the Download timer is broken - it usually runs through
"20 secs" in maybe 2-5 secs.  The setTimer call uses "time()" where all
other parts of LMS uses the "Hires::time" - IIRC low res time() is
unreliable on fast systems as it uses integers .  When code is change to
use Hires::time - the  20 secs timer works OK.
In Slim::Plugin::Extensions::Settings.pm _getReposCB

Code:
--------------------
    
                        # if a plugin is still being downloaded, wait a bit 
longer, or the user might restart the server before we're done
                        if ( $timeout-- > 0 && 
Slim::Utils::PluginDownloader->downloading ) {
                                Slim::Utils::Timers::setTimer(undef, 
Time::HiRes::time() + 1, $finalize);
  
                                main::DEBUGLOG && $log->is_debug && 
$log->debug("PluginDownloader is still busy - waiting a little longer...");
                                return;
                        }
  
--------------------


My suspicion is the bad SHA check may be part of the  action after
Download timer expires but since making this change SF has behaving
properly so I haven't been able to get a bad download.

So more testing is needed but other should make this change to at least
make Download timer work as designed.

If huge Plugin files on a unreliable server (i.e. downloads that take 30
mins) are to be supported change will need to be made. The main change
will be when to put up the "message box" it is triggered  in
Slim::Plugins::Extensions::Settings. _addinfo 

Code:
--------------------
    
        # don't offer the restart before the plugin download has succeeded.
        my $needsRestart = Slim::Utils::PluginManager->needsRestart || 
Slim::Utils::PluginDownloader->downloading;
  
--------------------

If this is changed to only appear when Download is complete
(Slim::Utils::PluginDownloader->downloading just shows how many files
are currently being downloaded) - it will need a timer to put up a
dialog box and then where will it appear - feels like a message set of
changes. Probably easiest to have a better "download failed " mechanism
which (knowing Triode's work)  I suspect is there but was broken by the
timer problem.


------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=112241

_______________________________________________
Squeezecenter mailing list
Squeezecenter@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/squeezecenter

Reply via email to