|
@@ -127,8 +127,10 @@ public class Listener implements Runnable {
|
|
|
server = new MyServerSocketFactory().createServerSocket(port);
|
|
|
if (server == null)
|
|
|
return false;
|
|
|
- if(protocol.toString().equals("SMB")) {
|
|
|
- ((SMB) protocol).setIP(Hostage.getContext().getSharedPreferences(Hostage.getContext().getString(R.string.connection_info), Hostage.MODE_PRIVATE).getString(Hostage.getContext().getString(R.string.connection_info_internal_ip), ""));
|
|
|
+ if (protocol.toString().equals("SMB")) {
|
|
|
+ ((SMB) protocol).setIP(Hostage.getContext()
|
|
|
+ .getSharedPreferences(Hostage.getContext().getString(R.string.connection_info), Hostage.MODE_PRIVATE)
|
|
|
+ .getString(Hostage.getContext().getString(R.string.connection_info_internal_ip), ""));
|
|
|
}
|
|
|
(this.thread = new Thread(this)).start();
|
|
|
running = true;
|
|
@@ -158,13 +160,13 @@ public class Listener implements Runnable {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Waits for an incoming connection, accepts it and starts a
|
|
|
- * {@link Handler}
|
|
|
+ * Waits for an incoming connection, accepts it and starts a {@link Handler}
|
|
|
*/
|
|
|
private void addHandler() {
|
|
|
if (conReg.isConnectionFree()) {
|
|
|
try {
|
|
|
Socket client = server.accept();
|
|
|
+ ConnectionGuard.registerConnection();
|
|
|
conReg.newOpenConnection();
|
|
|
if (protocol.isSecure()) {
|
|
|
startSecureHandler(client);
|
|
@@ -188,8 +190,7 @@ public class Listener implements Runnable {
|
|
|
* The Protocol the handler will run on
|
|
|
* @param client
|
|
|
* The Socket the handler uses
|
|
|
- * @return A Instance of a {@link Handler} with the specified
|
|
|
- * parameter.
|
|
|
+ * @return A Instance of a {@link Handler} with the specified parameter.
|
|
|
*/
|
|
|
private Handler newInstance(Hostage service, Listener listener, Protocol protocol, Socket client) {
|
|
|
return new Handler(service, listener, protocol, client);
|
|
@@ -207,8 +208,7 @@ public class Listener implements Runnable {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Creates a SSLSocket out of the given socket and starts a
|
|
|
- * {@link Handler}.
|
|
|
+ * Creates a SSLSocket out of the given socket and starts a {@link Handler}.
|
|
|
*
|
|
|
* @param client
|
|
|
* The socket with the accepted connection.
|