LOG(WARNING) << "Try to send request, Request type: "
<< pkgmgr_common::ReqTypeToString(req_type_);
- if (!socket_->Connect()) {
+ if (!socket_->Connect(req_type_)) {
LOG(ERROR) << "Failed to connect client socket, try to direct access";
is_offline_ = true;
return RequestHandlerDirectAccess(p.GetRaw());
#include "pkgmgrinfo_debug.h"
+namespace {
+
+bool IsDBWriteRequest(pkgmgr_common::ReqType req_type) {
+ if (req_type != pkgmgr_common::ReqType::SET_PKG_INFO &&
+ req_type != pkgmgr_common::ReqType::SET_CERT_INFO)
+ return false;
+
+ return true;
+}
+
+}
+
namespace pkgmgr_common {
namespace socket {
<< ", errno: " << errno;
}
-bool ClientSocket::Connect() {
+bool ClientSocket::Connect(ReqType req_type) {
if (Create() < 0)
return false;
- SetTimeout(5000);
+ SetTimeout(IsDBWriteRequest(req_type) ? 60 * 1000 : 5 * 1000);
int retry_cnt = 3;
do {
#define COMMON_CLIENT_SOCKET_HH_
#include "abstract_socket.hh"
+#include "request_type.hh"
namespace pkgmgr_common {
namespace socket {
class EXPORT_API ClientSocket: public AbstractSocket {
public:
ClientSocket(std::string path);
- bool Connect();
+ bool Connect(ReqType req_type);
private:
int TryConnection();