PLDM: 5 sec timeout for dbus calls without reply

This commit adds 5 second dbus timeout value to dbus calls with no reply. Previously a commit was merged that included 5 seconds dbus timeout value for all dbus call with reply.

This is added to make sure PLDM does not wait for more than 5 seconds when a dbus call is made with or without reply if no response is received from other daemon or host.

The 5 second timeout value is overridden to 10 seconds in meta-ibm layer

Change-Id: Ic20005d903732ac58bb22a657bf1b0c07439d435
Signed-off-by: vkaverap@in.ibm.com <vkaverap@in.ibm.com>
diff --git a/common/utils.cpp b/common/utils.cpp
index d44ae59..9162405 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -468,7 +468,7 @@
                                           logInterface, "Create");
         std::map<std::string, std::string> addlData{};
         method.append(errorMsg, severity, addlData);
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
@@ -489,7 +489,7 @@
             service.c_str(), dBusMap.objectPath.c_str(), dbusProperties, "Set");
         method.append(dBusMap.interface.c_str(), dBusMap.propertyName.c_str(),
                       variant);
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     };
 
     if (dBusMap.propertyType == "uint8_t")
diff --git a/common/utils.hpp b/common/utils.hpp
index d78d172..654b0b4 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -28,6 +28,11 @@
 using microsec = std::chrono::microseconds;
 using sec = std::chrono::seconds;
 
+constexpr uint64_t dbusTimeout =
+    std::chrono::duration_cast<std::chrono::microseconds>(
+        std::chrono::seconds(DBUS_TIMEOUT))
+        .count();
+
 namespace pldm
 {
 namespace utils
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index 094b5e5..dec7b3f 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -471,7 +471,7 @@
                                           dbusProperties, "Set");
         std::variant<BaseBIOSTable> value = baseBIOSTableMaps;
         method.append(biosConfigInterface, biosConfigPropertyName, value);
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 9005f66..f23cb20 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -139,7 +139,7 @@
         auto method = bus.new_method_call(service.c_str(), notifyObjPath,
                                           dumpInterface, "Notify");
         method.append(fileHandle, length);
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index 16ba928..2d1c68a 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -251,7 +251,7 @@
             auto method = bus.new_method_call(service.c_str(), logObjPath,
                                               logInterface, "HostAck");
             method.append(fileHandle);
-            bus.call_noreply(method);
+            bus.call_noreply(method, dbusTimeout);
         }
         catch (const std::exception& e)
         {
@@ -286,7 +286,7 @@
             auto method = bus.new_method_call(service.c_str(), logObjPath,
                                               logInterface, "HostReject");
             method.append(fileHandle, reason);
-            bus.call_noreply(method);
+            bus.call_noreply(method, dbusTimeout);
         }
         catch (const std::exception& e)
         {
@@ -323,7 +323,7 @@
                                           logInterface, "Create");
         method.append("xyz.openbmc_project.Host.Error.Event", severity,
                       addlData);
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index ed4bcc6..ce860d9 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
@@ -35,7 +35,7 @@
                       std::variant<std::tuple<uint64_t, std::vector<uint8_t>>>(
                           progressCodeBuffer));
 
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index fa025bd..b74e101 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -379,7 +379,7 @@
     {
         auto method = bus.new_method_call(UPDATER_SERVICE, SW_OBJ_PATH,
                                           DELETE_INTF, "DeleteAll");
-        bus.call_noreply(method);
+        bus.call_noreply(method, dbusTimeout);
     }
     catch (const std::exception& e)
     {
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index c4befbb..b53addc 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -542,7 +542,7 @@
             bus.new_method_call(watchDogService, watchDogObjectPath,
                                 watchDogInterface, watchDogResetPropName);
         resetMethod.append(true);
-        bus.call_noreply(resetMethod);
+        bus.call_noreply(resetMethod, dbusTimeout);
     }
     catch (const std::exception& e)
     {