nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #740: MINIFICPP-1144 - Fix HTTPCallback freeze and refactor class
Date Fri, 21 Feb 2020 15:46:30 GMT
bakaid commented on a change in pull request #740: MINIFICPP-1144 - Fix HTTPCallback freeze
and refactor class
URL: https://github.com/apache/nifi-minifi-cpp/pull/740#discussion_r382654840
 
 

 ##########
 File path: libminifi/include/utils/HTTPClient.h
 ##########
 @@ -201,15 +211,18 @@ class HTTPRequestResponse {
    */
 
   static size_t send_write(char * data, size_t size, size_t nmemb, void * p) {
-    if (p != 0) {
-      HTTPUploadCallback *callback = (HTTPUploadCallback*) p;
-      if (callback->stop)
-        return 0x10000000;
+    try {
+      if (p == nullptr) {
+        return CALLBACK_ABORT;
+      }
+      HTTPUploadCallback *callback = (HTTPUploadCallback *) p;
+      if (callback->stop) {
+        return CALLBACK_ABORT;
+      }
       size_t buffer_size = callback->ptr->getBufferSize();
       if (callback->getPos() <= buffer_size) {
         size_t len = buffer_size - callback->pos;
 
 Review comment:
   getPos locks a mutex and returns pos. Then this stuff accesses pos unlocked in the next
line. I didn't want to touch HTTPClient in this refactor, but yes, it is a mess.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message