Fix dynamic callback on HL (resolves issues in cURL)
This commit is contained in:
@@ -718,7 +718,8 @@ namespace lime {
|
|||||||
pos->v.i = position;
|
pos->v.i = position;
|
||||||
|
|
||||||
curl_gc_mutex.Unlock ();
|
curl_gc_mutex.Unlock ();
|
||||||
length = *((int*)writeCallback->Call (bytes, pos));
|
vdynamic* _length = (vdynamic*)writeCallback->Call (bytes, pos);
|
||||||
|
length = (_length != NULL ? _length->v.i : 0);
|
||||||
curl_gc_mutex.Lock ();
|
curl_gc_mutex.Lock ();
|
||||||
|
|
||||||
if (length == CURL_WRITEFUNC_PAUSE) {
|
if (length == CURL_WRITEFUNC_PAUSE) {
|
||||||
@@ -749,7 +750,8 @@ namespace lime {
|
|||||||
ulnow->v.d = progress->ulnow;
|
ulnow->v.d = progress->ulnow;
|
||||||
|
|
||||||
curl_gc_mutex.Unlock ();
|
curl_gc_mutex.Unlock ();
|
||||||
code = *((int*)progressCallback->Call (dltotal, dlnow, ultotal, ulnow));
|
vdynamic* _code = (vdynamic*)progressCallback->Call (dltotal, dlnow, ultotal, ulnow);
|
||||||
|
code = (_code != NULL ? _code->v.i : 0);
|
||||||
curl_gc_mutex.Lock ();
|
curl_gc_mutex.Lock ();
|
||||||
|
|
||||||
if (code != 0) { // CURLE_OK
|
if (code != 0) { // CURLE_OK
|
||||||
@@ -776,7 +778,8 @@ namespace lime {
|
|||||||
ulnow->v.i = xferInfo->ulnow;
|
ulnow->v.i = xferInfo->ulnow;
|
||||||
|
|
||||||
curl_gc_mutex.Unlock ();
|
curl_gc_mutex.Unlock ();
|
||||||
code = *((int*)xferInfoCallback->Call (dltotal, dlnow, ultotal, ulnow));
|
vdynamic* _code = (vdynamic*)xferInfoCallback->Call (dltotal, dlnow, ultotal, ulnow);
|
||||||
|
code = (_code != NULL ? _code->v.i : 0);
|
||||||
curl_gc_mutex.Lock ();
|
curl_gc_mutex.Lock ();
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
@@ -1706,7 +1709,7 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progressCallbacks[handle] = new ValuePointer (parameter);;
|
progressCallbacks[handle] = new ValuePointer (parameter);
|
||||||
progressValues[handle] = new CURL_Progress ();
|
progressValues[handle] = new CURL_Progress ();
|
||||||
|
|
||||||
code = curl_easy_setopt (easy_handle, type, progress_callback);
|
code = curl_easy_setopt (easy_handle, type, progress_callback);
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ class NativeHTTPRequest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function curl_onProgress(curl:CURL, dltotal:Float, dlnow:Float, uptotal:Float, upnow:Float):Void
|
private function curl_onProgress(curl:CURL, dltotal:Float, dlnow:Float, uptotal:Float, upnow:Float):Int
|
||||||
{
|
{
|
||||||
if (upnow > writeBytesLoaded || dlnow > writeBytesLoaded || uptotal > writeBytesTotal || dltotal > writeBytesTotal)
|
if (upnow > writeBytesLoaded || dlnow > writeBytesLoaded || uptotal > writeBytesTotal || dltotal > writeBytesTotal)
|
||||||
{
|
{
|
||||||
@@ -389,6 +389,8 @@ class NativeHTTPRequest
|
|||||||
// Wrong thread
|
// Wrong thread
|
||||||
// promise.progress (bytesLoaded, bytesTotal);
|
// promise.progress (bytesLoaded, bytesTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function curl_onWrite(curl:CURL, output:Bytes):Int
|
private function curl_onWrite(curl:CURL, output:Bytes):Int
|
||||||
|
|||||||
Reference in New Issue
Block a user