Fix double status increment on cached message relay
This commit is contained in:
		| @@ -10,8 +10,8 @@ import java.util.logging.Logger; | ||||
| import envoy.util.EnvoyLog; | ||||
|  | ||||
| /** | ||||
|  * Stores elements in a queue to process them later.<br> | ||||
|  * <br> | ||||
|  * Stores elements in a queue to process them later. | ||||
|  * <p> | ||||
|  * Project: <strong>envoy-client</strong><br> | ||||
|  * File: <strong>Cache.java</strong><br> | ||||
|  * Created: <strong>6 Feb 2020</strong><br> | ||||
| @@ -40,6 +40,9 @@ public class Cache<T> implements Consumer<T>, Serializable { | ||||
| 		elements.offer(element); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public String toString() { return String.format("Cache[elements=" + elements + "]"); } | ||||
|  | ||||
| 	/** | ||||
| 	 * Sets the processor to which cached elements are relayed. | ||||
| 	 * | ||||
|   | ||||
| @@ -47,9 +47,6 @@ public class WriteProxy { | ||||
| 			try { | ||||
| 				logger.log(Level.FINER, "Sending cached " + msg); | ||||
| 				client.sendMessage(msg); | ||||
|  | ||||
| 				// Update message state to SENT in localDB | ||||
| 				localDB.getMessage(msg.getID()).ifPresent(Message::nextStatus); | ||||
| 			} catch (final IOException e) { | ||||
| 				logger.log(Level.SEVERE, "Could not send cached message: ", e); | ||||
| 			} | ||||
|   | ||||
| @@ -164,6 +164,7 @@ public final class ChatScene { | ||||
| 	private void userListClicked() { | ||||
| 		final Contact user = userList.getSelectionModel().getSelectedItem(); | ||||
| 		if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) { | ||||
| 			logger.log(Level.FINEST, "Loading chat with " + user); | ||||
| 			contactLabel.setText(user.getName()); | ||||
|  | ||||
| 			// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes | ||||
|   | ||||
		Reference in New Issue
	
	Block a user