diff --git a/core/src/main/java/ch/dissem/bitmessage/BitmessageContext.java b/core/src/main/java/ch/dissem/bitmessage/BitmessageContext.java index 1b9b402..b06cf9a 100644 --- a/core/src/main/java/ch/dissem/bitmessage/BitmessageContext.java +++ b/core/src/main/java/ch/dissem/bitmessage/BitmessageContext.java @@ -281,7 +281,8 @@ public class BitmessageContext { public Property status() { return new Property("status", null, - ctx.getNetworkHandler().getNetworkStatus() + ctx.getNetworkHandler().getNetworkStatus(), + new Property("unacknowledged", ctx.getMessageRepository().findMessagesToResend().size()) ); } diff --git a/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java b/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java index 89b91dc..583669b 100644 --- a/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java +++ b/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java @@ -118,8 +118,27 @@ public class Application { } private void info() { - System.out.println(); - System.out.println(ctx.status()); + String command; + do { + System.out.println(); + System.out.println(ctx.status()); + System.out.println(); + System.out.println("c) cleanup inventory"); + System.out.println("r) resend unacknowledged messages"); + System.out.println(COMMAND_BACK); + + command = commandLine.nextCommand(); + switch (command) { + case "c": + ctx.cleanup(); + break; + case "r": + ctx.resendUnacknowledgedMessages(); + break; + case "b": + return; + } + } while (!"b".equals(command)); } private void identities() { diff --git a/repositories/src/main/resources/db/migration/V3.2__Update_table_message.sql b/repositories/src/main/resources/db/migration/V3.2__Update_table_message.sql index 38847cf..1eba39f 100644 --- a/repositories/src/main/resources/db/migration/V3.2__Update_table_message.sql +++ b/repositories/src/main/resources/db/migration/V3.2__Update_table_message.sql @@ -1,4 +1,4 @@ ALTER TABLE Message ADD COLUMN ack_data BINARY(32); -ALTER TABLE Message ADD COLUMN ttl BIGINT NOT NULL; +ALTER TABLE Message ADD COLUMN ttl BIGINT NOT NULL DEFAULT 0; ALTER TABLE Message ADD COLUMN retries INT NOT NULL DEFAULT 0; ALTER TABLE Message ADD COLUMN next_try BIGINT;