getBufferedAmount() functionality for HttpResponse<SSL> #1802
MacroMelon
started this conversation in
General
Replies: 1 comment 5 replies
-
If you use curl_easy_perform then you are using the blocking calls from what I understand, and if you then want to wait for some other thread's signal you want a conditional variable. So whenever your onWritable has getBufferedAmount() 0, then you just signal your conditional variable and then your curl thread will continue. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I was wondering if there was a way to get the backpressure in an HttpResponse object.
My implementation is such that I need to be able to wait till the the backpressure has gone to zero to continue sending, but I cant use callbacks (like onWriteable) because I'm executing this in another callback - yes, it's a bit messy but at the moment I dont really have a better solution :(
Context: In the route handler I'm using libcurl to httpget a large file, and I want to write the contents to the HttpResponse as the data comes. I know for a fact that the HttpResponse client transfer speed is slower than the curl get (in my case) and a buildup of backpressure is basically garanteed. I'm writing in the curl write function as follows:
(dont mind the exessive cout, those are just for debugging, clientConnection is the HttpResponse object)
So it flows like: writeFunction gets called for new data chunk, it writes it to the HttpResponse object, if backpressure it pauses the curl transfer till the backpressure is zero and then resumes it.
If I could pause libcurl as the writefunction exits and unpause in the onWriteable handler it would be perfect, but curl_easy_perform is non-blocking and I have a feeling it is holding the uWS code from running (I'm not sure though). I've also tried switching to a curl_multi system that doesnt block, and waiting in a while loop but the onWritable still doesn't get called.
Here is my onWriteable if interested:
Beta Was this translation helpful? Give feedback.
All reactions