Skip to content

Commit

Permalink
Merge pull request #14 from heremaps/Fix-#13
Browse files Browse the repository at this point in the history
Fix #13: Remove unnecessary close call.
  • Loading branch information
marcelpinto authored Apr 3, 2018
2 parents 2315770 + ae2f3af commit 0c60781
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/main/java/com/here/oksse/RealServerSentEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ private void openSse(Response response) {
private void notifyFailure(Throwable throwable, Response response) {
if (!retry(throwable, response)) {
listener.onClosed(this);
if (call != null && !call.isCanceled()) {
call.cancel();
close();
}
close();
}
}

Expand Down Expand Up @@ -135,12 +132,9 @@ public void setTimeout(long timeout, TimeUnit unit) {

@Override
public void close() {
if (call != null) {
if (call != null && !call.isCanceled()) {
call.cancel();
}
if (sseReader != null) {
sseReader.close();
}
}

/**
Expand Down Expand Up @@ -191,17 +185,6 @@ boolean read() {
return true;
}

/**
* Close the source
*/
void close() {
try {
source.close();
} catch (IOException e) {
// Close quietly
}
}

/**
* Sets a reading timeout, so the read operation will get unblock if this timeout is reached.
*
Expand Down

0 comments on commit 0c60781

Please sign in to comment.