OSDN Git Service

Allow response payload on RIL_REQUEST error
authorjohnwang <johnwang@google.com>
Tue, 2 Jun 2009 21:55:45 +0000 (14:55 -0700)
committerjohnwang <johnwang@google.com>
Tue, 2 Jun 2009 22:58:01 +0000 (15:58 -0700)
Enable response payload while RIL_REQUEST returns error. RIL must explicitly pass NULL
for the response parameter if there is no response payload.

modified:   ril.cpp

libril/ril.cpp

index 65edba1..7baad99 100644 (file)
@@ -2621,8 +2621,8 @@ RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responsel
 
         p.writeInt32 (e);
 
-        if (e == RIL_E_SUCCESS) {
-            /* process response on success */
+        if (response != NULL) {
+            // there is a response payload, no matter success or not.
             ret = pRI->pCI->responseFunction(p, response, responselen);
 
             /* if an error occurred, rewind and mark it */
@@ -2630,8 +2630,10 @@ RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responsel
                 p.setDataPosition(errorOffset);
                 p.writeInt32 (ret);
             }
-        } else {
-            appendPrintBuf("%s returns %s", printBuf, failCauseToString(e));
+        }
+
+        if (e != RIL_E_SUCCESS) {
+            appendPrintBuf("%s fails by %s", printBuf, failCauseToString(e));
         }
 
         if (s_fdCommand < 0) {