projects
/
xudocci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Let the core verify each minute that all configured channels are joined.
[xudocci.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
irc
/
Connection.java
diff --git
a/src/main/java/net/pterodactylus/irc/Connection.java
b/src/main/java/net/pterodactylus/irc/Connection.java
index
10edc3c
..
88059ba
100644
(file)
--- a/
src/main/java/net/pterodactylus/irc/Connection.java
+++ b/
src/main/java/net/pterodactylus/irc/Connection.java
@@
-115,6
+115,9
@@
public class Connection extends AbstractExecutionThreadService implements Servic
/** The connection handler. */
private ConnectionHandler connectionHandler;
/** The connection handler. */
private ConnectionHandler connectionHandler;
+ /** Whether the connection has already been established. */
+ private boolean established;
+
/**
* Creates a new connection.
*
/**
* Creates a new connection.
*
@@
-139,6
+142,16
@@
public class Connection extends AbstractExecutionThreadService implements Servic
//
/**
//
/**
+ * Returns whether this connection has already been established.
+ *
+ * @return {@code true} as long as this connection is established, {@code
+ * false} otherwise
+ */
+ public boolean established() {
+ return established;
+ }
+
+ /**
* Returns the nickname that is currently in use by this connection. The
* nickname is only available once the connection has been {@link #start()}ed.
*
* Returns the nickname that is currently in use by this connection. The
* nickname is only available once the connection has been {@link #start()}ed.
*
@@
-447,6
+460,7
@@
public class Connection extends AbstractExecutionThreadService implements Servic
if ((connectionStatus == 0x0f) && (connectionStatus != oldConnectionStatus)) {
/* connection succeeded! */
if ((connectionStatus == 0x0f) && (connectionStatus != oldConnectionStatus)) {
/* connection succeeded! */
+ established = true;
eventBus.post(new ConnectionEstablished(this));
}
oldConnectionStatus = connectionStatus;
eventBus.post(new ConnectionEstablished(this));
}
oldConnectionStatus = connectionStatus;
@@
-456,6
+470,7
@@
public class Connection extends AbstractExecutionThreadService implements Servic
logger.log(Level.WARNING, "I/O error", ioe1);
eventBus.post(new ConnectionClosed(this, ioe1));
} finally {
logger.log(Level.WARNING, "I/O error", ioe1);
eventBus.post(new ConnectionClosed(this, ioe1));
} finally {
+ established = false;
logger.info("Closing Connection.");
try {
Closeables.close(connectionHandler, true);
logger.info("Closing Connection.");
try {
Closeables.close(connectionHandler, true);