Skip to content

Commit

Permalink
Responder: Check if a message need to be sent (responsePublisher == n…
Browse files Browse the repository at this point in the history
…ull)
  • Loading branch information
stevegury committed Oct 15, 2015
1 parent 8ab7391 commit 468dadf
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/main/java/io/reactivesocket/internal/Responder.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,25 @@ public void onNext(Frame requestFrame) {
final RejectedException exception = new RejectedException("No associated lease");
responsePublisher = PublisherUtils.errorFrame(streamId, exception);
}

connection.addOutput(responsePublisher, new Completable() {
@Override
public void success() {
// TODO Auto-generated method stub
}

@Override
public void error(Throwable e) {
// TODO validate with unit tests
if (childTerminated.compareAndSet(false, true)) {
errorStream.accept(new RuntimeException("Error writing", e)); // TODO should we have typed RuntimeExceptions?
cancel();
if (responsePublisher != null) {
connection.addOutput(responsePublisher, new Completable() {
@Override
public void success() {
// TODO Auto-generated method stub
}
}

});
@Override
public void error(Throwable e) {
// TODO validate with unit tests
if (childTerminated.compareAndSet(false, true)) {
errorStream.accept(new RuntimeException("Error writing", e)); // TODO should we have typed RuntimeExceptions?
cancel();
}
}

});
}
}
}

Expand Down

0 comments on commit 468dadf

Please sign in to comment.