void sfsextauth::register_with_agent () { sfsagent_addextauth_arg arg; arg.pid = getpid (); set_name (arg.name); u_int i = get_expire_time (); arg.expire = i; ref<bool> res = New refcounted<bool> (); ac->call (AGENTCTL_ADDEXTAUTH, &arg, res, wrap (this, &sfsextauth::registration_cb, res)); }
void Consumer::work() { if(m_mqd == (mqd_t)-1) return; WorkItem item; ssize_t receivedBytes = 0; timespec ts = get_expire_time(); // The reason why we must +1 to the sizeof(WorkItem) is that the mq_receive requires the // buffer size must be greater than the msgsize_max receivedBytes = mq_timedreceive(m_mqd, (char*)&item, sizeof(WorkItem) + 1, NULL, &ts); if(receivedBytes > 0) consume_item(item); else if(receivedBytes == 0) std::cout << "0 length message received" << std::endl; else if(errno != ETIMEDOUT) { std::cout << "Error is " << strerror(errno) << std::endl; std::cout << "Oops, fail to receive message from Consumer " << m_id << ". Bytes = " << receivedBytes << std::endl; } }