Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ public static DaveSessionImpl create(@Nullable String authSessionId) {
MemorySegment authSessionIdSegment =
authSessionId != null ? local.allocateFrom(authSessionId) : MemorySegment.NULL;
MemorySegment session = LibDaveSessionBinding.createSession(MemorySegment.NULL, authSessionIdSegment);
return new DaveSessionImpl(session);

DaveSessionImpl result = new DaveSessionImpl(session);
// this part of memory is not initialized by libdave
// until we call #initialize or #reset meaning it just
// has a random value of whatever was there before making
// it very confusing to debug
result.setProtocolVersion((short) -1);
return result;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public synchronized void onMLSPrepareCommitTransition(int transitionId, @NonNull
prepareProtocolTransition(transitionId, session.getProtocolVersion());
} else {
sendInvalidCommitWelcome(transitionId);
handleDaveProtocolInit(transitionId);
handleDaveProtocolInit(session.getProtocolVersion());
}
}
}
Expand All @@ -247,7 +247,7 @@ public synchronized void onMLSWelcome(int transitionId, @NonNull ByteBuffer welc
prepareProtocolTransition(transitionId, session.getProtocolVersion());
} else {
sendInvalidCommitWelcome(transitionId);
handleDaveProtocolInit(transitionId);
handleDaveProtocolInit(session.getProtocolVersion());
}
}

Expand Down Expand Up @@ -292,9 +292,10 @@ private void prepareProtocolTransition(int transitionId, int protocolVersion) {
encryptor.processTransition(protocolVersion);
} else {
preparedTransitions.put(transitionId, protocolVersion);
currentProtocolVersion = protocolVersion;
callbacks.sendDaveProtocolReadyForTransition(transitionId);
}

currentProtocolVersion = protocolVersion;
}

private void executeProtocolTransition(int transitionId) {
Expand Down