Skip to content
Snippets Groups Projects
Commit f999b4aa authored by Shawn Pearce's avatar Shawn Pearce
Browse files

Fix interrupted write in StreamCopyThread


If a flush() gets delivered at the same time that we are blocking
while writing to an interruptable stream, the copy thread will
abort assuming its a stream error.  Instead ignore the interrupt,
and retry the write.

Change-Id: Icbf62d1b8abe0fabbb532dbee088020eecf4c6c2
Signed-off-by: default avatarShawn O. Pearce <spearce@spearce.org>
parent 3f143b8d
No related branches found
No related tags found
No related merge requests found
......@@ -100,11 +100,25 @@ public void run() {
try {
n = src.read(buf);
} catch (InterruptedIOException wakey) {
continue;
if (flushCounter.get() > 0)
continue;
else
throw wakey;
}
if (n < 0)
break;
dst.write(buf, 0, n);
for (;;) {
try {
dst.write(buf, 0, n);
} catch (InterruptedIOException wakey) {
if (flushCounter.get() > 0)
continue;
else
throw wakey;
}
break;
}
} catch (IOException e) {
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment