Commit fdd56fa8 authored by Daniel Wolf's avatar Daniel Wolf

Locking is never required for pollBytesToDevice as it is only called on one thread

parent 4478fbaf
......@@ -94,12 +94,8 @@ class TunnelHandle(proxy: Proxy,
fun hasDataForDevice():Boolean = byteReadCounter != byteWriteCounter
internal fun pollBytesToDevice():ByteArray? {
return if(needsLocking) {
synchronized(byteOutput) {
byteOutput[byteReadCounter++ % maxConcurrentAnswerSize]
}
} else {
byteOutput[byteReadCounter++ % maxConcurrentAnswerSize]
return (byteReadCounter++ % maxConcurrentAnswerSize).let {
byteOutput[it]
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment