Skip to content

Commit ea54af0

Browse files
authored
Merge pull request #252 from pusher/multiple-connections-on-retry
Do not use the disconnect method to tear down on pong timeout
2 parents 979d537 + a9ffd09 commit ea54af0

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# pusher-websocket-java changelog
22

3+
## Version 2.1.1 - 15th April 2020
4+
5+
* Fix a case where multiple websocket connections could be opened at once
6+
if reconnection was triggered by an activity timeout.
7+
38
## Version 2.1.0 - 8th April 2020
49

510
* Added support for [private encrypted channels](https://pusher.com/docs/channels/using_channels/encrypted-channels)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The pusher-java-client is available in Maven Central.
6161
<dependency>
6262
<groupId>com.pusher</groupId>
6363
<artifactId>pusher-java-client</artifactId>
64-
<version>2.1.0</version>
64+
<version>2.1.1</version>
6565
</dependency>
6666
</dependencies>
6767
```
@@ -70,7 +70,7 @@ The pusher-java-client is available in Maven Central.
7070

7171
```groovy
7272
dependencies {
73-
compile 'com.pusher:pusher-java-client:2.1.0'
73+
compile 'com.pusher:pusher-java-client:2.1.1'
7474
}
7575
```
7676

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ apply plugin: 'signing'
2222
apply plugin: 'jacoco'
2323

2424
group = "com.pusher"
25-
version = "2.1.0"
25+
version = "2.1.1"
2626
sourceCompatibility = "1.8"
2727
targetCompatibility = "1.8"
2828

@@ -201,4 +201,4 @@ jacocoTestReport {
201201
reports.xml.enabled = true
202202
reports.html.enabled = false
203203
reports.csv.enabled = false
204-
}
204+
}

src/main/java/com/pusher/client/connection/websocket/WebSocketConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public void run() {
403403

404404
underlyingConnection.removeWebSocketListener();
405405

406-
disconnect();
406+
underlyingConnection.close();
407407

408408
// Proceed immediately to handle the close
409409
// The WebSocketClient will attempt a graceful WebSocket shutdown by exchanging the close frames

src/test/java/com/pusher/client/connection/websocket/WebSocketConnectionTest.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,13 @@ public void testDisconnectInDisconnectingStateIsIgnored() {
298298
}
299299

300300
@Test
301-
public void testPongTimeoutResultsInDisconnect() throws InterruptedException {
301+
public void testPongTimeoutResultsInClosingConnection() throws InterruptedException {
302302
when(factory.getTimers()).thenReturn(new ScheduledThreadPoolExecutor(2));
303303

304304
connection.connect();
305305
connection.onMessage(CONN_ESTABLISHED_EVENT);
306306

307307
verify(mockUnderlyingConnection, timeout((int) (ACTIVITY_TIMEOUT + PONG_TIMEOUT))).close();
308-
309-
verify(mockEventListener).onConnectionStateChange(
310-
new ConnectionStateChange(ConnectionState.CONNECTED, ConnectionState.DISCONNECTING));
311-
312-
verify(mockEventListener).onConnectionStateChange(
313-
new ConnectionStateChange(ConnectionState.DISCONNECTING, ConnectionState.DISCONNECTED));
314-
315-
assertEquals(ConnectionState.DISCONNECTED, connection.getState());
316308
}
317309

318310
@Test

0 commit comments

Comments
 (0)