22 #ifndef Hyperspace_SessionData_h
23 #define Hyperspace_SessionData_h
39 SessionData(
const sockaddr_in &_addr, uint32_t lease_interval, uint64_t _id)
42 std::chrono::milliseconds(lease_interval);
46 std::lock_guard<std::mutex> lock(
mutex);
49 notification->
event_ptr->decrement_notification_count();
57 std::lock_guard<std::mutex> lock(
mutex);
58 std::list<Notification *>::iterator iter =
notifications.begin();
60 if (delivered_events.count((*iter)->event_ptr->get_id()) > 0) {
61 (*iter)->event_ptr->decrement_notification_count();
77 std::lock_guard<std::mutex> lock(
mutex);
78 std::list<Notification *>::iterator iter;
82 len += (*iter)->event_ptr->encoded_length();
85 cbuf =
new CommBuf(header, len);
91 (*iter)->event_ptr->encode(cbuf);
97 std::lock_guard<std::mutex> lock(
mutex);
98 auto now = std::chrono::steady_clock::now();
110 std::lock_guard<std::mutex> lock(
mutex);
115 std::lock_guard<std::mutex> lock(
mutex);
120 std::lock_guard<std::mutex> lock(
mutex);
124 std::list<Notification *>::iterator iter =
notifications.begin();
126 (*iter)->event_ptr->decrement_notification_count();
133 std::lock_guard<std::mutex> lock(
mutex);
138 std::lock_guard<std::mutex> lock(
mutex);
159 bool operator()(
const SessionDataPtr &x,
const SessionDataPtr &y)
const {
166 #endif // Hyperspace_SessionData_h
const struct sockaddr_in & get_addr() const
std::string String
A String is simply a typedef to std::string.
std::list< Notification * > notifications
std::shared_ptr< SessionData > SessionDataPtr
bool is_expired(std::chrono::steady_clock::time_point now)
SessionData(const sockaddr_in &_addr, uint32_t lease_interval, uint64_t _id)
const char * get_name() const
void set_expire_time_now()
void extend_lease(std::chrono::milliseconds millis)
void append_i32(uint32_t ival)
Appends a 32-bit integer to the primary buffer.
uint32_t m_lease_interval
void append_i64(uint64_t lval)
Appends a 64-bit integer to the primary buffer.
void purge_notifications(std::set< uint64_t > &delivered_events)
void set_name(const String &name_)
HyperspaceEventPtr event_ptr
Message buffer for holding data to be transmitted over a network.
CommBuf * serialize_notifications_for_keepalive(CommHeader &header, uint32_t &len)
std::chrono::steady_clock::time_point expire_time
void add_notification(Notification *notification)
bool operator>(const directory< _Key, _Tp, _Compare, _Allocator > &__x, const directory< _Key, _Tp, _Compare, _Allocator > &__y)
bool operator()(const SessionDataPtr &x, const SessionDataPtr &y) const