Change-Id: Iceb6ba89e6c7a40f93e555faad1e0e72894f8725
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
<< ", 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 {
private:
int TryConnection();
void SetTimeout(int timeout_msec);
+ int GetTimeoutFromEnv();
};
} // namespace socket