}
int ReceiveResponse(ClientSocket* client, Response** response) {
+ int flags = fcntl(client->GetFd(), F_GETFL, 0);
+ fcntl(client->GetFd(), F_SETFL, flags & ~O_NONBLOCK);
+
size_t size = 0;
int ret = client->Receive(reinterpret_cast<void*>(&size), sizeof(size));
if (ret != 0) {
- _E("Receive() is failed. error(%d)", ret); // LCOV_EXCL_LINE
- return -1; // LCOV_EXCL_LINE
+ // LCOV_EXCL_START
+ _E("Receive() is failed. error(%d)", ret);
+ fcntl(client->GetFd(), F_SETFL, flags);
+ return -1;
+ // LCOV_EXCL_STOP
}
uint8_t* buf = static_cast<uint8_t*>(malloc(size));
if (buf == nullptr) {
- _E("Out of memory"); // LCOV_EXCL_LINE
- return -1; // LCOV_EXCL_LINE
+ // LCOV_EXCL_START
+ _E("Out of memory");
+ fcntl(client->GetFd(), F_SETFL, flags);
+ return -1;
+ // LCOV_EXCL_STOP
}
ret = client->Receive(buf, size);
if (ret != 0) {
// LCOV_EXCL_START
_E("Receive() is failed. error(%d)", ret);
+ fcntl(client->GetFd(), F_SETFL, flags);
free(buf);
return -1;
// LCOV_EXCL_STOP
tizen_base::Parcel parcel(buf, size, false);
*response = new (std::nothrow) Response();
if (*response == nullptr) {
- _E("Out of memory"); // LCOV_EXCL_LINE
- return -1; // LCOV_EXCL_LINE
+ // LCOV_EXCL_START
+ _E("Out of memory");
+ fcntl(client->GetFd(), F_SETFL, flags);
+ return -1;
+ // LCOV_EXCL_STOP
}
+ fcntl(client->GetFd(), F_SETFL, flags);
parcel.ReadParcelable(*response);
return 0;
}
main_client_->SetNonblock();
fds_[0] = main_client_->RemoveFd();
} else {
+ main_client_->SetNonblock();
ret = main_client_->Watch();
if (ret != 0)
return RPC_PORT_ERROR_IO_ERROR; // LCOV_EXCL_LINE
delegate_client_->SetNonblock();
fds_[1] = delegate_client_->RemoveFd();
} else {
+ delegate_client_->SetNonblock();
ret = delegate_client_->Watch();
if (ret != 0)
return RPC_PORT_ERROR_IO_ERROR; // LCOV_EXCL_LINE