Skip to content

Commit 46418ef

Browse files
authored
0.65.0
- More aggressive closing of connection by transport.
2 parents 60602b6 + 1d4c3d9 commit 46418ef

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ subprojects {
55
apply plugin: 'maven'
66

77
group 'org.iot-dsa'
8-
version '0.64.1'
8+
version '0.65.0'
99

1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -57,5 +57,5 @@ allprojects {
5757
}
5858

5959
wrapper {
60-
gradleVersion = '5.4.1'
60+
gradleVersion = '5.5.1'
6161
}

dslink-v2-api/src/main/java/org/iot/dsa/node/DSNode.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,13 @@ public ActionResult invoke(DSInfo action, DSInfo target, ActionInvocation reques
694694
return action.getAction().invoke(target, request);
695695
}
696696

697+
/**
698+
* True if this is the default instance for the type.
699+
*/
700+
public final boolean isDefaultInstance() {
701+
return defaultInstance == defaultDefaultInstance;
702+
}
703+
697704
/**
698705
* Returns false.
699706
*/
@@ -1200,9 +1207,9 @@ protected DSInfo declareDefault(String name, DSIObject value, String description
12001207
}
12011208

12021209
/**
1203-
* The is only called once for each class. It's purpose is to define the default children of
1204-
* the node subtype. Use the declareDefault method to add non-removable children that all
1205-
* runtime instances should have. Be sure to call super.declareDefaults().
1210+
* This only called once for each class. It's purpose is to define the default children of
1211+
* the node subtype. Use the declareDefault method to add permanent children that all
1212+
* runtime instances will have. Be sure to call super.declareDefaults().
12061213
*
12071214
* @see #declareDefault(String, DSIObject) To create non-removable children.
12081215
*/
@@ -1247,13 +1254,6 @@ protected String getLogName() {
12471254
return "dsa";
12481255
}
12491256

1250-
/**
1251-
* True if this is the default instance for the type.
1252-
*/
1253-
protected final boolean isDefaultInstance() {
1254-
return defaultInstance == defaultDefaultInstance;
1255-
}
1256-
12571257
/**
12581258
* Convenience for instanceof DSNode.
12591259
*/

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/transport/DSTransportWs.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import javax.websocket.OnOpen;
1414
import javax.websocket.RemoteEndpoint;
1515
import javax.websocket.Session;
16+
import org.iot.dsa.dslink.DSLinkConnection;
1617

1718
/**
1819
* Abstract websocket transport.
@@ -52,7 +53,15 @@ public void close() {
5253
} catch (IOException x) {
5354
debug(null, x);
5455
}
55-
getConnection().getSession().recvMessage(true);
56+
synchronized (this) {
57+
notifyAll();
58+
if (available() > 0) {
59+
DSLinkConnection conn = getConnection();
60+
if (conn != null) {
61+
conn.getSession().recvMessage(true);
62+
}
63+
}
64+
}
5665
}
5766

5867
@Override
@@ -67,13 +76,15 @@ public void endRecvMessage() {
6776
public void onClose(CloseReason reason) {
6877
if (isOpen()) {
6978
debug("Remotely closed: " + reason.toString());
79+
getConnection().connDown(reason.toString());
7080
close();
7181
}
7282
}
7383

7484
@OnError
7585
public void onError(Throwable err) {
7686
if (isOpen()) {
87+
getConnection().connDown(err.toString());
7788
close(err);
7889
}
7990
}
@@ -190,6 +201,13 @@ protected EndpointConfig getConfig() {
190201
return config;
191202
}
192203

204+
/**
205+
* The session passed to onOpen.
206+
*/
207+
protected Session getSession() {
208+
return session;
209+
}
210+
193211
///////////////////////////////////////////////////////////////////////////
194212
// Private Methods
195213
///////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)