LwHttp, ignore readers that try to close InputStream.

This commit is contained in:
Hannes Janetzek 2014-02-24 16:29:54 +01:00
parent a98ddca171
commit 5c05b81dfa

View File

@ -148,6 +148,12 @@ public class LwHttp {
return bytesRead == contentLength;
}
@Override
public void close() throws IOException {
if (dbg)
log.debug("close()... ignored");
}
@Override
public synchronized void mark(int readlimit) {
if (dbg)
@ -205,8 +211,8 @@ public class LwHttp {
if (data >= 0)
bytesRead += 1;
if (dbg)
log.debug("read {} {}", bytesRead, contentLength);
//if (dbg)
// log.debug("read {} {}", bytesRead, contentLength);
if (cache != null && bytesRead > bytesWrote) {
bytesWrote = bytesRead;
@ -332,8 +338,15 @@ public class LwHttp {
close();
else if (System.nanoTime() - mLastRequest > RESPONSE_TIMEOUT)
close();
else if (mResponseStream.available() > 0)
close();
else {
try {
if (mResponseStream.available() > 0)
close();
} catch (IOException e) {
log.debug(e.getMessage());
close();
}
}
}
if (mSocket == null) {