Commit 9d964d51 authored by Daniel Wolf's avatar Daniel Wolf

Save the event type which has to be used

parent 77c78f93
......@@ -124,17 +124,21 @@ open class VPNTunnelProxy(val packetProxy: PacketProxy,
logger?.info("Launching threads...")
val eventsReadBothActive = if(readEnd == writeEnd) OsConstants.POLLOUT or OsConstants.POLLIN
else OsConstants.POLLIN
val eventsWriteBothActive = if(readEnd == writeEnd) 0
else OsConstants.POLLOUT
proxyThread = Thread {
logger?.info("Proxy started on thread " + Thread.currentThread().name)
try {
try {
while(shouldRun) {
if (tunnelHandle?.hasDataForDevice() == true) {
deviceInputPipe.wantedEvents(0)
deviceOutputPipe.wantedEvents(OsConstants.POLLOUT)
deviceOutputPipe.wantedEvents(eventsWriteBothActive)
deviceInputPipe.wantedEvents(eventsReadBothActive)
} else {
deviceOutputPipe.wantedEvents(0)
deviceInputPipe.wantedEvents(deviceInputPipe.events.toInt() or OsConstants.POLLIN)
deviceInputPipe.wantedEvents(OsConstants.POLLIN)
}
val pollableAnswers = createRemoteReadingPipes(errorStruct, deviceOutputPipe, deviceInputPipe)
......
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