Skip to content

Commit

Permalink
Speed up RemoteFile::Read() EOF handling.
Browse files Browse the repository at this point in the history
Stuart Morgan discovered the regression. This code got slower in the
MythSocket conversion. But with some small changes playback startup
and seeks with RemoteFile are now faster than they have ever been.
  • Loading branch information
daniel-kristjansson committed Nov 26, 2012
1 parent 368239a commit f7b6f9b
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions mythtv/libs/libmythbase/remotefile.cpp
Expand Up @@ -557,23 +557,14 @@ int RemoteFile::Read(void *data, int size)

while (recv < sent && !error && mtimer.elapsed() < 10000)
{
MythTimer ctt; // check control socket timer
ctt.start();
while ((recv < sent) && (ctt.elapsed() < 500))
{
int ret = sock->Read(
((char *)data) + recv, sent - recv, 500);
if (ret > 0)
{
recv += ret;
}
else if (ret < 0)
{
error = true;
}
if (waitms < 200)
waitms += 20;
}
int ret = sock->Read(((char *)data) + recv, sent - recv, waitms);

if (ret > 0)
recv += ret;
else if (ret < 0)
error = true;

waitms += (waitms < 200) ? 20 : 0;

if (controlSock->IsDataAvailable() &&
controlSock->ReadStringList(strlist, MythSocket::kShortTimeout) &&
Expand Down

0 comments on commit f7b6f9b

Please sign in to comment.