Skip to content

Commit 9a52088

Browse files
committed
Add regression test for #80
8cc2b0f did indeed fix the problem. closes #80
1 parent d3e4b1b commit 9a52088

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

core/src/test/java/tel/schich/javacan/test/RawCanSocketTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import tel.schich.javacan.RawReceiveMessageHeaderBuffer;
3232
import tel.schich.javacan.platform.linux.LinuxNativeOperationException;
3333

34+
import java.io.IOException;
3435
import java.nio.ByteBuffer;
3536
import java.time.Duration;
3637
import java.time.Instant;
@@ -347,4 +348,11 @@ void testReceiveHeaders() throws Exception {
347348
assertEquals(Instant.now().getEpochSecond(), messageHeaderBuffer.getSoftwareTimestamp().getEpochSecond());
348349
}
349350
}
351+
352+
@Test
353+
public void repeatedCloseShouldDoNothing() throws IOException {
354+
final RawCanChannel socket = CanChannels.newRawChannel();
355+
socket.close();
356+
socket.close();
357+
}
350358
}

epoll/src/test/java/tel/schich/javacan/test/select/EPollSelectorTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,11 @@ private static SelectorRegistration<UnixFileDescriptor, RawCanChannel> configure
138138

139139
return registration;
140140
}
141+
142+
@Test
143+
public void repeatedCloseShouldDoNothing() throws IOException {
144+
EPollSelector selector = EPollSelector.open();
145+
selector.close();
146+
selector.close();
147+
}
141148
}

0 commit comments

Comments
 (0)