A bit more robust handling on read() or write() errors.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1375 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Pierre Ossman 2007-01-10 09:15:15 +00:00
parent dea4960e3a
commit 95c21876c1

View File

@ -49,6 +49,7 @@ static int dsp_mode;
static int dsp_refs;
static RD_BOOL dsp_configured;
static RD_BOOL dsp_broken;
static RD_BOOL dsp_out;
static RD_BOOL dsp_in;
@ -131,6 +132,7 @@ oss_open(int fallback)
}
dsp_configured = False;
dsp_broken = False;
dsp_mode = O_RDWR;
dsp_fd = open(dsp_dev, O_RDWR | O_NONBLOCK);
@ -389,10 +391,17 @@ oss_play(void)
if (len == -1)
{
if (errno != EWOULDBLOCK)
perror("write audio");
{
if (!dsp_broken)
perror("RDPSND: write()");
dsp_broken = True;
rdpsnd_queue_next(0);
}
return;
}
dsp_broken = False;
out->p += len;
if (out->p == out->end)
@ -441,10 +450,17 @@ oss_record(void)
if (len == -1)
{
if (errno != EWOULDBLOCK)
perror("read audio");
{
if (!dsp_broken)
perror("RDPSND: read()");
dsp_broken = True;
rdpsnd_queue_next(0);
}
return;
}
dsp_broken = False;
rdpsnd_record(buffer, len);
}