Fixed size error when cleaning the stack trace
This commit is contained in:
parent
305e3bb085
commit
cd42f6b85d
|
@ -32,23 +32,26 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: KLogg
|
||||||
fun cleanStackTrace(throwable: Throwable) {
|
fun cleanStackTrace(throwable: Throwable) {
|
||||||
// NOTE: when we remove stuff, we ONLY want to remove the "tail" of the stacktrace, not ALL parts of the stacktrace
|
// NOTE: when we remove stuff, we ONLY want to remove the "tail" of the stacktrace, not ALL parts of the stacktrace
|
||||||
val stackTrace = throwable.stackTrace
|
val stackTrace = throwable.stackTrace
|
||||||
var newEndIndex = stackTrace.size - 1
|
var newEndIndex = Math.max(0, stackTrace.size - 1)
|
||||||
for (i in newEndIndex downTo 0) {
|
|
||||||
val stackName = stackTrace[i].className
|
if (newEndIndex > 0) {
|
||||||
if (i == newEndIndex) {
|
for (i in newEndIndex downTo 0) {
|
||||||
if (stackName.startsWith("kotlinx.coroutines.") ||
|
val stackName = stackTrace[i].className
|
||||||
stackName.startsWith("kotlin.coroutines.") ||
|
if (i == newEndIndex) {
|
||||||
stackName.startsWith("dorkbox.network.")) {
|
if (stackName.startsWith("kotlinx.coroutines.") ||
|
||||||
newEndIndex--
|
stackName.startsWith("kotlin.coroutines.") ||
|
||||||
} else {
|
stackName.startsWith("dorkbox.network.")) {
|
||||||
break
|
newEndIndex--
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// tailToChopIndex will also remove the VERY LAST CachedMethod or CachedAsmMethod access invocation (because it's offset by 1)
|
// tailToChopIndex will also remove the VERY LAST CachedMethod or CachedAsmMethod access invocation (because it's offset by 1)
|
||||||
// NOTE: we want to do this!
|
// NOTE: we want to do this!
|
||||||
throwable.stackTrace = stackTrace.copyOfRange(0, newEndIndex)
|
throwable.stackTrace = stackTrace.copyOfRange(0, newEndIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,10 +240,10 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: KLogg
|
||||||
|
|
||||||
// first run through the IP connection filters, THEN run through the "custom" filters
|
// first run through the IP connection filters, THEN run through the "custom" filters
|
||||||
|
|
||||||
val address = connection.remoteAddressInt
|
// val address = connection.remoteAddressInt
|
||||||
|
|
||||||
// it's possible for a remote address to match MORE than 1 rule.
|
// it's possible for a remote address to match MORE than 1 rule.
|
||||||
var isAllowed = false
|
// var isAllowed = false
|
||||||
|
|
||||||
// these are the IP filters (optimized checking based on simple IP rules)
|
// these are the IP filters (optimized checking based on simple IP rules)
|
||||||
onConnectIpFilterList.value.forEach {
|
onConnectIpFilterList.value.forEach {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user