本文整理汇总了C++中SyncSession::create_sync_session方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncSession::create_sync_session方法的具体用法?C++ SyncSession::create_sync_session怎么用?C++ SyncSession::create_sync_session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncSession
的用法示例。
在下文中一共展示了SyncSession::create_sync_session方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: revive_if_needed
bool revive_if_needed(std::unique_lock<std::mutex>& lock, SyncSession& session) const override
{
// Revive.
session.create_sync_session();
session.advance_state(lock, waiting_for_access_token);
return true;
}
示例2: bind_with_admin_token
void bind_with_admin_token(std::unique_lock<std::mutex>& lock, SyncSession& session,
const std::string& admin_token,
const std::string& server_url) const override
{
session.create_sync_session();
session.advance_state(lock, waiting_for_access_token);
session.m_state->refresh_access_token(lock, session, admin_token, server_url);
}
示例3: refresh_access_token
void refresh_access_token(std::unique_lock<std::mutex>& lock, SyncSession& session,
std::string access_token,
const util::Optional<std::string>& server_url) const override
{
session.create_sync_session();
// Since the sync session was previously unbound, it's safe to do this from the
// calling thread.
if (!session.m_server_url) {
session.m_server_url = server_url;
}
if (session.m_session_has_been_bound) {
session.m_session->refresh(std::move(access_token));
session.m_session->cancel_reconnect_delay();
} else {
session.m_session->bind(*session.m_server_url, std::move(access_token));
session.m_session_has_been_bound = true;
}
if (session.m_server_override)
session.m_session->override_server(session.m_server_override->address, session.m_server_override->port);
// Register all the pending wait-for-completion blocks.
for (auto& package : session.m_completion_wait_packages) {
(*session.m_session.*package.waiter)(std::move(package.callback));
}
session.m_completion_wait_packages.clear();
// Handle any deferred commit notification.
if (session.m_deferred_commit_notification) {
session.m_session->nonsync_transact_notify(*session.m_deferred_commit_notification);
session.m_deferred_commit_notification = util::none;
}
session.advance_state(lock, active);
if (session.m_deferred_close) {
session.m_state->close(lock, session);
}
}