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