git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'subtree'
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
serial
/
server
/
ConnectActionServer.java
diff --git
a/src/be/nikiroo/utils/serial/server/ConnectActionServer.java
b/src/be/nikiroo/utils/serial/server/ConnectActionServer.java
index 10d3440e7af4a4a09e5b7cdf06151ab15ac98f66..350d3fe40a1320b68f555458a43c3ceec11e8c25 100644
(file)
--- a/
src/be/nikiroo/utils/serial/server/ConnectActionServer.java
+++ b/
src/be/nikiroo/utils/serial/server/ConnectActionServer.java
@@
-23,14
+23,16
@@
abstract class ConnectActionServer {
protected ConnectAction action;
/**
protected ConnectAction action;
/**
- * Create a new {@link ConnectActionServer} with the current application
- * version (see {@link Version#getCurrentVersion()}) as the server version.
+ * Create a new {@link ConnectActionServer}, using the current version.
*
* @param s
* the socket to bind to
*
* @param s
* the socket to bind to
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
*/
*/
- public ConnectActionServer(Socket s) {
- this(s, Version.getCurrentVersion());
+ public ConnectActionServer(Socket s
, String key
) {
+ this(s,
key,
Version.getCurrentVersion());
}
/**
}
/**
@@
-38,11
+40,14
@@
abstract class ConnectActionServer {
*
* @param s
* the socket to bind to
*
* @param s
* the socket to bind to
- * @param version
- * the server version
+ * @param key
+ * an optional key to encrypt all the communications (if NULL,
+ * everything will be sent in clear text)
+ * @param serverVersion
+ * the version of this server,that will be sent to the client
*/
*/
- public ConnectActionServer(Socket s,
Version v
ersion) {
- action = new ConnectAction(s, true,
v
ersion) {
+ public ConnectActionServer(Socket s,
String key, Version serverV
ersion) {
+ action = new ConnectAction(s, true,
key, serverV
ersion) {
@Override
protected void action(Version clientVersion) throws Exception {
ConnectActionServer.this.action(clientVersion);
@Override
protected void action(Version clientVersion) throws Exception {
ConnectActionServer.this.action(clientVersion);
@@
-87,6
+92,8
@@
abstract class ConnectActionServer {
* <p>
* Example of usage: the client failed an authentication check, cut the
* connection here and now.
* <p>
* Example of usage: the client failed an authentication check, cut the
* connection here and now.
+ *
+ * @return TRUE when it is
*/
public boolean isClosing() {
return closing;
*/
public boolean isClosing() {
return closing;
@@
-120,14
+127,14
@@
abstract class ConnectActionServer {
* @return the amount of bytes sent
*/
public long getBytesSent() {
* @return the amount of bytes sent
*/
public long getBytesSent() {
- return action.getBytes
Sent
();
+ return action.getBytes
Written
();
}
/**
* Method that will be called when an action is performed on the server.
*
* @param clientVersion
}
/**
* Method that will be called when an action is performed on the server.
*
* @param clientVersion
- * the
client version
+ * the
version of the client connected to this server
*
* @throws Exception
* in case of I/O error
*
* @throws Exception
* in case of I/O error