<< ", errno: " << errno;
}
+int ClientSocket::GetTimeoutFromEnv() {
+ const char* timeout_str = getenv("PKGMGR_SOCKET_TIMEOUT");
+ if (timeout_str == nullptr)
+ return -1;
+
+ int timeout_msec = atoi(timeout_str);
+ if (timeout_msec <= 0)
+ return -1;
+
+ return timeout_msec;
+}
+
bool ClientSocket::Connect(ReqType req_type) {
if (Create() < 0)
return false;
- SetTimeout(IsDBWriteRequest(req_type) ? 60 * 1000 : 5 * 1000);
+ int timeout = GetTimeoutFromEnv();
+ if (timeout <= 0)
+ timeout = IsDBWriteRequest(req_type) ? 60 * 1000 : 5 * 1000;
+ SetTimeout(timeout);
int retry_cnt = 3;
do {