fix reconnection option
This commit is contained in:
@@ -80,7 +80,7 @@ public class IO {
|
|||||||
*/
|
*/
|
||||||
public boolean multiplex = true;
|
public boolean multiplex = true;
|
||||||
|
|
||||||
public boolean reconnection;
|
public boolean reconnection = true;
|
||||||
public int reconnectionAttempts;
|
public int reconnectionAttempts;
|
||||||
public long reconnectionDelay;
|
public long reconnectionDelay;
|
||||||
public long reconnectionDelayMax;
|
public long reconnectionDelayMax;
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ public class Manager extends Emitter {
|
|||||||
private void onclose() {
|
private void onclose() {
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
this.readyState = ReadyState.CLOSED;
|
this.readyState = ReadyState.CLOSED;
|
||||||
if (!this.skipReconnect) {
|
if (this._reconnection && !this.skipReconnect) {
|
||||||
this.reconnect();
|
this.reconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,9 +87,7 @@ public class ServerConnectionTest {
|
|||||||
public void openAndClose() throws URISyntaxException, InterruptedException {
|
public void openAndClose() throws URISyntaxException, InterruptedException {
|
||||||
final BlockingQueue<String> events = new LinkedBlockingQueue<String>();
|
final BlockingQueue<String> events = new LinkedBlockingQueue<String>();
|
||||||
|
|
||||||
IO.Options opts = new IO.Options();
|
socket = client();
|
||||||
opts.forceNew = true;
|
|
||||||
socket = IO.socket(uri(), opts);
|
|
||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... objects) {
|
||||||
@@ -114,9 +112,7 @@ public class ServerConnectionTest {
|
|||||||
public void message() throws URISyntaxException, InterruptedException {
|
public void message() throws URISyntaxException, InterruptedException {
|
||||||
final BlockingQueue<Object[]> events = new LinkedBlockingQueue<Object[]>();
|
final BlockingQueue<Object[]> events = new LinkedBlockingQueue<Object[]>();
|
||||||
|
|
||||||
IO.Options opts = new IO.Options();
|
socket = client();
|
||||||
opts.forceNew = true;
|
|
||||||
socket = IO.socket(uri(), opts);
|
|
||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... objects) {
|
||||||
@@ -145,9 +141,7 @@ public class ServerConnectionTest {
|
|||||||
final JsonObject obj = new JsonObject();
|
final JsonObject obj = new JsonObject();
|
||||||
obj.addProperty("foo", 1);
|
obj.addProperty("foo", 1);
|
||||||
|
|
||||||
IO.Options opts = new IO.Options();
|
socket = client();
|
||||||
opts.forceNew = true;
|
|
||||||
socket = IO.socket(uri(), opts);
|
|
||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... objects) {
|
||||||
@@ -174,9 +168,7 @@ public class ServerConnectionTest {
|
|||||||
final JsonObject obj = new JsonObject();
|
final JsonObject obj = new JsonObject();
|
||||||
obj.addProperty("foo", 1);
|
obj.addProperty("foo", 1);
|
||||||
|
|
||||||
IO.Options opts = new IO.Options();
|
socket = client();
|
||||||
opts.forceNew = true;
|
|
||||||
socket = IO.socket(uri(), opts);
|
|
||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... objects) {
|
||||||
@@ -200,9 +192,7 @@ public class ServerConnectionTest {
|
|||||||
public void ackWithoutArgs() throws URISyntaxException, InterruptedException {
|
public void ackWithoutArgs() throws URISyntaxException, InterruptedException {
|
||||||
final BlockingQueue<Object[]> events = new LinkedBlockingQueue<Object[]>();
|
final BlockingQueue<Object[]> events = new LinkedBlockingQueue<Object[]>();
|
||||||
|
|
||||||
IO.Options opts = new IO.Options();
|
socket = client();
|
||||||
opts.forceNew = true;
|
|
||||||
socket = IO.socket(uri(), opts);
|
|
||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... objects) {
|
||||||
@@ -221,6 +211,13 @@ public class ServerConnectionTest {
|
|||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Socket client() throws URISyntaxException {
|
||||||
|
IO.Options opts = new IO.Options();
|
||||||
|
opts.forceNew = true;
|
||||||
|
opts.reconnection = false;
|
||||||
|
return IO.socket(uri(), opts);
|
||||||
|
}
|
||||||
|
|
||||||
private String uri() {
|
private String uri() {
|
||||||
return "http://localhost:" + PORT + nsp();
|
return "http://localhost:" + PORT + nsp();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user