http://bugzilla.moblin.org/show_bug.cgi?id=6376
--- Comment #2 from yongsheng zhu <yongsheng.zhu(a)intel.com> 2009-12-10 00:11:32 PST
---
Here I give some my thinkings about this issue, just pseudocode
/** This function is called by session or others who want to ask information
from dbus clients */
bool DBusServer::handleInfoRequest(Session *session,const string &type,
std::map<string, string> ¶meters, std::map<string, string>
&response) {
emit signal InfoRequest("request") with a unique id(id)
m_id = id
m_reqStatus = "request"
g_main_loop_run(loop) /// add timeout mechanism
if(id == m_id && m_reqStatus == "response") {
response = m_response;
clear m_id, m_response
send signal InfoRequest("done")
return true;
}
// timeout or response status is not expected, return false
return false;
}
// function for DBusServer DBus method 'InfoResponse'
DBusServer::infoResponse(string id, string state, std::map<string, string>
&response)
{
if (id != m_id) {
return; /// or throw an error?
} else if(state == "working") {
if m_reqStatus == "request"
send signal InfoRequest("waiting") /// what is the handler for the
replied client?
else
ignore
} else if (state == "response") {
m_response = response /// possible no 'working' state sent by clients
g_main_loop_quit(loop)
}
}
Is the logic reasonable?
questions:
1) If the active session request an info, do we need put it in the queue and
let the next waiting session run? Currently I assume not.
2) what is the 'handler' for InfoRequest("waiting")? we don't have
any
information about which client sends the InfoResponse. Maybe we need add some
interfaces in dbus to fetch the dbus client identifier.
--
Configure bugmail:
http://bugzilla.moblin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching someone on the CC list of the bug.