Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Little more trace! logging in crdt/packet/streamer #686

Merged
merged 2 commits into from
Jul 18, 2018
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
3 changes: 3 additions & 0 deletions ci/test-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ _ cargo build --verbose --features unstable
_ cargo test --verbose --features unstable
_ cargo clippy -- --deny=warnings

exit 0

# Coverage disabled (see issue #433)
_ cargo cov test
_ cargo cov report

Expand Down
12 changes: 7 additions & 5 deletions src/crdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,11 @@ impl Crdt {
/// challenging part is that we are on a permissionless network
pub fn purge(&mut self, now: u64) {
if self.table.len() <= MIN_TABLE_SIZE {
trace!("purge: skipped: table too small: {}", self.table.len());
return;
}
if self.leader_data().is_none() {
trace!("purge: skipped: no leader_data");
return;
}
let leader_id = self.leader_data().unwrap().id;
Expand Down Expand Up @@ -995,8 +997,8 @@ impl Crdt {
match deserialize(&blob.data[..blob.meta.size]) {
// TODO sigverify these
Ok(Protocol::RequestUpdates(v, from_rd)) => {
trace!("RequestUpdates {}", v);
let addr = from_rd.contact_info.ncp;
trace!("RequestUpdates {} from {}", v, addr);
let me = obj.read().unwrap();
// only lock for these two calls, dont lock during IO `sock.send_to` or `sock.recv_from`
let (from, ups, data) = me.get_updates_since(v);
Expand Down Expand Up @@ -1029,16 +1031,16 @@ impl Crdt {
None
}
}
Ok(Protocol::ReceiveUpdates(from, ups, data, external_liveness)) => {
Ok(Protocol::ReceiveUpdates(from, update_index, data, external_liveness)) => {
trace!(
"ReceivedUpdates {:x} {} {}",
"ReceivedUpdates from={:x} update_index={} len={}",
make_debug_id(&from),
ups,
update_index,
data.len()
);
obj.write()
.expect("'obj' write lock in ReceiveUpdates")
.apply_updates(from, ups, &data, &external_liveness);
.apply_updates(from, update_index, &data, &external_liveness);
None
}
Ok(Protocol::RequestWindowIndex(from, ix)) => {
Expand Down
2 changes: 2 additions & 0 deletions src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ impl Packets {
Ok((nrecv, from)) => {
p.meta.size = nrecv;
p.meta.set_addr(&from);
trace!("got {} bytes from {}", nrecv, from);
if i == 0 {
socket.set_nonblocking(true)?;
}
Expand Down Expand Up @@ -405,6 +406,7 @@ impl Blob {
Ok((nrecv, from)) => {
p.meta.size = nrecv;
p.meta.set_addr(&from);
trace!("got {} bytes from {}", nrecv, from);
if i == 0 {
socket.set_nonblocking(true)?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn responder(
//TODO, we would need to stick block authentication before we create the
//window.
fn recv_blobs(recycler: &BlobRecycler, sock: &UdpSocket, s: &BlobSender) -> Result<()> {
trace!("receiving on {}", sock.local_addr().unwrap());
trace!("recv_blobs: receiving on {}", sock.local_addr().unwrap());
let dq = Blob::recv_from(recycler, sock)?;
if !dq.is_empty() {
s.send(dq)?;
Expand Down