File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/main/java/org/ice4j/socket Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,23 @@ public class DTLSDatagramFilter
3636 */
3737 public static boolean isDTLS (DatagramPacket p )
3838 {
39- int len = p .getLength ();
39+ return p != null && isDTLS (p .getData (), p .getOffset (), p .getLength ());
40+ }
4041
42+ /**
43+ * Determines whether the buffer represented by {@code data}, {@code off}
44+ * and {@code len} looks like a DTLS packet.
45+ *
46+ * @param data the array that contains the data.
47+ * @param off the offset.
48+ * @param len the length.
49+ * @return {@code true} if the buffer looks like a DTLS packet; otherwise,
50+ * {@code false}.
51+ */
52+ public static boolean isDTLS (byte [] data , int off , int len )
53+ {
4154 if (len > 0 )
4255 {
43- byte [] data = p .getData ();
44- int off = p .getOffset ();
4556 int fb = data [off ] & 0xff ;
4657
4758 return 19 < fb && fb < 64 ;
You can’t perform that action at this time.
0 commit comments