Add todo and curly brackets

This commit is contained in:
chimp1984 2020-08-25 21:31:06 -05:00
parent 5433707fa2
commit 06f407fda3
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3

View file

@ -225,7 +225,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
// Called from various threads
public void sendMessage(NetworkEnvelope networkEnvelope) {
log.debug(">> Send networkEnvelope of type: " + networkEnvelope.getClass().getSimpleName());
log.debug(">> Send networkEnvelope of type: {}", networkEnvelope.getClass().getSimpleName());
if (!stopped) {
if (noCapabilityRequiredOrCapabilityIsSupported(networkEnvelope)) {
@ -319,6 +319,8 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
}
}
// TODO: If msg is BundleOfEnvelopes we should check each individual message for capability and filter out those
// which fail.
public boolean noCapabilityRequiredOrCapabilityIsSupported(Proto msg) {
boolean result;
if (msg instanceof AddDataMessage) {
@ -408,12 +410,13 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
public void onMessage(NetworkEnvelope networkEnvelope, Connection connection) {
checkArgument(connection.equals(this));
if (networkEnvelope instanceof BundleOfEnvelopes)
if (networkEnvelope instanceof BundleOfEnvelopes) {
for (NetworkEnvelope current : ((BundleOfEnvelopes) networkEnvelope).getEnvelopes()) {
UserThread.execute(() -> messageListeners.forEach(e -> e.onMessage(current, connection)));
}
else
} else {
UserThread.execute(() -> messageListeners.forEach(e -> e.onMessage(networkEnvelope, connection)));
}
}