Skip to content

Commit

Permalink
Keep prev data only when delta negotiated (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia authored Oct 10, 2024
1 parent 9ad97af commit d0678bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions centrifuge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ javadoc {
metalava {
hiddenPackages.add("io.github.centrifugal.centrifuge.internal")
}

test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ void handlePublication(Protocol.Publication pub) throws Exception {
ClientInfo info = ClientInfo.fromProtocolClientInfo(pub.getInfo());
PublicationEvent event = new PublicationEvent();
byte[] pubData = pub.getData().toByteArray();
byte[] prevData = this.getPrevData();
if (prevData != null && pub.getDelta()) {
pubData = Fossil.applyDelta(prevData, pubData);
if (this.deltaNegotiated) {
byte[] prevData = this.getPrevData();
if (prevData != null && pub.getDelta()) {
pubData = Fossil.applyDelta(prevData, pubData);
}
this.setPrevData(pubData);
}
this.setPrevData(pubData);
event.setData(pubData);
event.setInfo(info);
event.setOffset(pub.getOffset());
Expand Down

0 comments on commit d0678bf

Please sign in to comment.