Forum Discussion
IheartF5_45022
Dec 12, 2013Nacreous
One last crack at this. I haven't tested it sorry, but the logic makes sense to me - basically each TCP connection, the 2 * clientside ones and the serverside one, will spend nearly all their time in blocking mode 'collecting' data from their respective endpoints. When they have client data to send they have to grab a flag indicating that they have the serverside connection now.
If this doesn't work I can raise another forum question pointing to this one to see if anyone else has any ideas.
when CLIENT_ACCEPTED {
Collect the whole request (this will trigger CLIENT_DATA)
if {$debug} {log local0. "[IP::remote_addr]:[TCP::remote_port]"}
TCP::collect
}
when CLIENT_DATA {
We have the whole response - wait for the serverside connection to be free, then release the request, and release the session table lock. Then collect again.
while {[table lookup "fProxyinProgress"] != ""} {
if {$debug} {log local0. "Request in progress - wait 50ms"}
after 50
}
if {$debug} {log local0. "Setting flag for [IP::remote_addr]:[TCP::remote_port]"}
Set session table lock
table set "fProxyinProgress" "1" 1
TCP::release
TCP::collect
}
when SERVER_CONNECTED {
TCP::collect
}
when SERVER_DATA {
We have the whole response - release it, and release the session table lock
table delete "fProxyinProgress"
TCP::release
Start collecting the next server response
TCP::collect
}