ClientChannel::~ClientChannel() { GLib::SourceDestroy(source_); }
-ClientChannel* ClientChannel::Create(IEvent* listener,
+std::unique_ptr<ClientChannel> ClientChannel::Create(IEvent* listener,
const std::string& endpoint) {
try {
std::unique_ptr<ClientChannel> client =
client->SetReceiveTimeout(rpc_port_get_timeout());
_W("endpoint(%s), fd(%d)", endpoint.c_str(), client->GetFd());
- return client.release();
+ return client;
} catch (const Exception& e) {
// LCOV_EXCL_START
_E("Exception(%s) occurs", e.what());
explicit ClientChannel(IEvent* listener);
virtual ~ClientChannel();
- static ClientChannel* Create(IEvent* listener, const std::string& endpoint);
+ static std::unique_ptr<ClientChannel> Create(IEvent* listener, const std::string& endpoint);
int Watch();
private:
if (ret != 0) return RPC_PORT_ERROR_IO_ERROR;
}
- channel->reset(client);
+ channel->reset(client.release());
return RPC_PORT_ERROR_NONE;
}