mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 15:53:26 -10:00
Log the join handshake steps at info level to time where a guest waits
This commit is contained in:
1 parent
4080405ef4
commit
cf75b0e99a
2 files changed
+8
No files matched your search
@@ -383,6 +383,7 @@ impl Replica {
|
||||
epoch: self.epoch,
|
||||
seq: self.seq,
|
||||
};
|
||||
log::info!("Join handshake: hello sent to {transport_peer:?} as {:?}", self.role);
|
||||
self.transport.send(transport_peer, &hello)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -390,6 +391,7 @@ impl Replica {
|
||||
fn handle_packet(&mut self, from: TransportPeerId, packet: SyncPacket, target: &mut dyn SyncTarget, events: &mut Vec<Event>) -> Result<(), ReplicaError> {
|
||||
match packet {
|
||||
SyncPacket::Hello { peer, user, role, epoch, seq } => {
|
||||
log::info!("Join handshake: hello from {peer:?} ({role:?}), synced {}", self.is_synced());
|
||||
self.peers.insert(from, RemotePeer { peer, user, role });
|
||||
self.anchor_delivered(peer, epoch, seq);
|
||||
|
||||
@@ -402,6 +404,7 @@ impl Replica {
|
||||
self.resources_stale = true;
|
||||
|
||||
if role == Role::Host && !self.is_synced() {
|
||||
log::info!("Join handshake: sync request sent to the host");
|
||||
self.transport.send(from, &SyncPacket::SyncRequest { known_revs: target.known_revs() })?;
|
||||
}
|
||||
}
|
||||
@@ -426,6 +429,7 @@ impl Replica {
|
||||
return Ok(());
|
||||
}
|
||||
let shares_history = known_revs.iter().any(|&rev| target.contains_rev(rev));
|
||||
log::info!("Join handshake: sync request from {from:?}, shares history {shares_history}");
|
||||
let sync = SyncPayload {
|
||||
registry: (!shares_history).then(|| target.retired_registry()),
|
||||
deltas: target.deltas_unknown_to(&known_revs),
|
||||
@@ -437,9 +441,11 @@ impl Replica {
|
||||
retracted: target.retracted_marks(),
|
||||
document_id: target.document_id(),
|
||||
};
|
||||
log::info!("Join handshake: sync answered with {} deltas and {} hot ops", sync.deltas.len(), sync.hot_log.len());
|
||||
self.transport.send(from, &SyncPacket::Sync(Box::new(sync)))?;
|
||||
}
|
||||
SyncPacket::Sync(sync) => {
|
||||
log::info!("Join handshake: sync received with {} deltas, full registry {}", sync.deltas.len(), sync.registry.is_some());
|
||||
let SyncState::AwaitingSync { pending } = std::mem::replace(&mut self.sync, SyncState::Synced) else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
@@ -151,6 +151,7 @@ impl MessageHandler<SyncMessage, SyncMessageContext<'_>> for SyncMessageHandler
|
||||
for event in events {
|
||||
match event {
|
||||
Event::Synced => {
|
||||
log::info!("Join handshake: synced, applying the host's state");
|
||||
self.dirty.insert(document_id);
|
||||
self.fit_after_sync.insert(document_id);
|
||||
}
|
||||
@@ -196,6 +197,7 @@ impl MessageHandler<SyncMessage, SyncMessageContext<'_>> for SyncMessageHandler
|
||||
if document.apply_remote_changes(responses) {
|
||||
self.dirty.remove(&document_id);
|
||||
if self.fit_after_sync.remove(&document_id) && Some(document_id) == active_document_id {
|
||||
log::info!("Join handshake: the host's state is applied, fitting the viewport after the graph runs");
|
||||
// The bounds come from the render, so the fit waits for the graph to run on the new document.
|
||||
responses.add(DeferMessage::AfterGraphRun {
|
||||
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into()],
|
||||
|
||||
Reference in new issue
Block a user