Skip to content

Commit

Permalink
Don't write on a closed channel
Browse files Browse the repository at this point in the history
Update to cope with junit cve
  • Loading branch information
steely-glint committed Oct 13, 2020
1 parent 73bc9ac commit 154c8bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ipseorama</groupId>
<artifactId>slice</artifactId>
<version>1.0.92-local</version>
<version>1.1.0</version>
<packaging>jar</packaging>
<repositories>
<repository>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/ipseorama/slice/SingleThreadNioIceEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,14 @@ private Long tx() {
if (far != null) {
Log.verb(StunPacket.hexString(sp.getTid()) + " sending packet type " + sp.getClass().getSimpleName() + " length " + o.length + " to " + far);
ByteBuffer src = ByteBuffer.wrap(o);
if (ch.isConnected()) {
ch.write(src);
if (ch.isOpen()) {
if (ch.isConnected()) {
ch.write(src);
} else {
ch.send(src, far);
}
} else {
ch.send(src, far);
Log.debug("chanel is closed "+ch);
}
} else {
Log.verb("not sending packet to unresolved address");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void receivedReply(StunPacket r) {
if (this._far.equals(reflex)){
Log.debug("far ip confirmed as "+reflex);
} else {
Log.info("new Ip found (peer reflexive) "+reflex+" on "+this.candidatePair);
Log.debug("new Ip found (peer reflexive) "+reflex+" on "+this.candidatePair);
}
if (oncomplete != null) {
oncomplete.onEvent(this);
Expand Down

0 comments on commit 154c8bf

Please sign in to comment.