diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp
index a76182b4f6..91495236ed 100644
--- a/api/boinc_api.cpp
+++ b/api/boinc_api.cpp
@@ -150,6 +150,10 @@ static int have_network = 1;
bool g_sleep = false;
// simulate unresponsive app by setting to true (debugging)
static FUNC_PTR timer_callback = 0;
+char web_graphics_url[256];
+bool send_web_graphics_url = false;
+char remote_desktop_addr[256];
+bool send_remote_desktop_addr = false;
#define TIMER_PERIOD 0.1
// period of worker-thread timer interrupts.
@@ -1126,7 +1130,7 @@ static void timer_handler() {
fprintf(stderr, "%s 1 sec elapsed\n", boinc_msg_prefix(buf, sizeof(buf)));
#endif
- // here it we're at a one-second boundary; do slow stuff
+ // here if we're at a one-second boundary; do slow stuff
//
if (!ready_to_checkpoint) {
@@ -1178,6 +1182,25 @@ static void timer_handler() {
if (timer_callback) {
timer_callback();
}
+
+ // send graphics-related messages
+ //
+ if (send_web_graphics_url && !app_client_shm->shm->graphics_reply.has_msg()) {
+ sprintf(buf,
+ "%s",
+ web_graphics_url
+ );
+ app_client_shm->shm->graphics_reply.send_msg(buf);
+ send_web_graphics_url = false;
+ }
+ if (send_remote_desktop_addr && !app_client_shm->shm->graphics_reply.has_msg()) {
+ sprintf(buf,
+ "%s",
+ remote_desktop_addr
+ );
+ app_client_shm->shm->graphics_reply.send_msg(buf);
+ send_remote_desktop_addr = false;
+ }
}
#ifdef _WIN32
@@ -1451,20 +1474,13 @@ double boinc_elapsed_time() {
}
void boinc_web_graphics_url(char* url) {
- char buf[256];
if (standalone) return;
- sprintf(buf, "%s", url);
- app_client_shm->shm->graphics_reply.send_msg(buf);
+ strcpy(web_graphics_url, url);
+ send_web_graphics_url = true;
}
-void boinc_remote_desktop_connection(char* connection) {
- char buf[256];
+void boinc_remote_desktop_addr(char* addr) {
if (standalone) return;
- sprintf(buf, "%s", connection);
- app_client_shm->shm->graphics_reply.send_msg(buf);
-}
-
-void boinc_send_settings_raw(char* settings) {
- if (standalone) return;
- app_client_shm->shm->graphics_reply.send_msg(settings);
+ strcpy(remote_desktop_addr, addr);
+ send_remote_desktop_addr = true;
}
diff --git a/api/boinc_api.h b/api/boinc_api.h
index 800793b4ed..9c8dfcf730 100644
--- a/api/boinc_api.h
+++ b/api/boinc_api.h
@@ -118,8 +118,7 @@ extern void boinc_register_timer_callback(FUNC_PTR);
extern double boinc_worker_thread_cpu_time();
extern int boinc_init_parallel();
extern void boinc_web_graphics_url(char*);
-extern void boinc_remote_desktop_connection(char*);
-extern void boinc_send_settings_raw(char*);
+extern void boinc_remote_desktop_addr(char*);
#ifdef __APPLE__
extern int setMacPList(void);
diff --git a/checkin_notes b/checkin_notes
index 1d0702ec0e..7ec593fa7a 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -464,3 +464,23 @@ Rom 13 Jan 2012
samples/vboxwrapper
vboxwrapper.cpp
+
+David 13 Jan 2012
+ - API: fix queueing problem for graphics-related messages
+ (web graphics URL and remote desktop addr)
+ - GUI RPC and API:
+ change "remote_desktop_connection" to "remote_desktop_addr" everywhere.
+ It's an address, not a connection.
+ - vboxwrapper: log message cleanup
+
+ api/
+ boinc_api.cpp,h
+ client/
+ app.cpp,h
+ app_control.cpp
+ lib/
+ gui_rpc_client_ops.cpp
+ gui_rpc_client.h
+ app_ipc.cpp,h
+ samples/
+ vboxwrapper.cpp
diff --git a/client/app.cpp b/client/app.cpp
index 2a6a66e579..08768cd8fa 100644
--- a/client/app.cpp
+++ b/client/app.cpp
@@ -121,7 +121,7 @@ ACTIVE_TASK::ACTIVE_TASK() {
overdue_checkpoint = false;
last_deadline_miss_time = 0;
strcpy(web_graphics_url, "");
- strcpy(remote_desktop_connection, "");
+ strcpy(remote_desktop_addr, "");
}
// preempt this task;
@@ -594,10 +594,10 @@ int ACTIVE_TASK::write_gui(MIOFILE& fout) {
web_graphics_url
);
}
- if (strlen(remote_desktop_connection)) {
+ if (strlen(remote_desktop_addr)) {
fout.printf(
- " %s\n",
- remote_desktop_connection
+ " %s\n",
+ remote_desktop_addr
);
}
fout.printf("\n");
diff --git a/client/app.h b/client/app.h
index 4a6c9ff5ec..078bb8d5a8 100644
--- a/client/app.h
+++ b/client/app.h
@@ -151,7 +151,7 @@ struct ACTIVE_TASK {
// (e.g. VMs created by vboxwrapper)
// These are communicated via the app_status message channel
char web_graphics_url[256];
- char remote_desktop_connection[256];
+ char remote_desktop_addr[256];
void set_task_state(int, const char*);
inline int task_state() {
diff --git a/client/app_control.cpp b/client/app_control.cpp
index 61aed6de48..70b60e0983 100644
--- a/client/app_control.cpp
+++ b/client/app_control.cpp
@@ -1212,7 +1212,7 @@ void ACTIVE_TASK::get_graphics_msg() {
}
parse_str(msg_buf, "", web_graphics_url, sizeof(web_graphics_url));
- parse_str(msg_buf, "", remote_desktop_connection, sizeof(remote_desktop_connection));
+ parse_str(msg_buf, "", remote_desktop_addr, sizeof(remote_desktop_addr));
}
}
diff --git a/lib/app_ipc.cpp b/lib/app_ipc.cpp
index 75c72d8ed1..e243b56b0e 100644
--- a/lib/app_ipc.cpp
+++ b/lib/app_ipc.cpp
@@ -397,13 +397,8 @@ bool MSG_CHANNEL::get_msg(char *msg) {
return true;
}
-bool MSG_CHANNEL::has_msg() {
- if (buf[0]) return true;
- return false;
-}
-
bool MSG_CHANNEL::send_msg(const char *msg) {
- if (buf[0]) return false;
+ if (has_msg()) return false;
strlcpy(buf+1, msg, MSG_CHANNEL_SIZE-1);
buf[0] = 1;
return true;
diff --git a/lib/app_ipc.h b/lib/app_ipc.h
index 05fb4c8d61..d247ce1568 100644
--- a/lib/app_ipc.h
+++ b/lib/app_ipc.h
@@ -53,7 +53,9 @@
struct MSG_CHANNEL {
char buf[MSG_CHANNEL_SIZE];
bool get_msg(char*); // returns a message and clears pending flag
- bool has_msg();
+ inline bool has_msg() {
+ return buf[0]?true:false;
+ }
bool send_msg(const char*); // if there is not a message in the segment,
// writes specified message and sets pending flag
void send_msg_overwrite(const char*);
diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h
index b228b9e6f8..0d45f90e05 100644
--- a/lib/gui_rpc_client.h
+++ b/lib/gui_rpc_client.h
@@ -277,7 +277,7 @@ public:
bool edf_scheduled;
char graphics_exec_path[512];
char web_graphics_url[256];
- char remote_desktop_connection[256];
+ char remote_desktop_addr[256];
char slot_path[512];
// only present if graphics_exec_path is
char resources[256];
diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp
index 54ed6d3981..64ceb81fc0 100644
--- a/lib/gui_rpc_client_ops.cpp
+++ b/lib/gui_rpc_client_ops.cpp
@@ -535,7 +535,7 @@ int RESULT::parse(XML_PARSER& xp) {
if (xp.parse_bool("edf_scheduled", edf_scheduled)) continue;
if (xp.parse_str("graphics_exec_path", graphics_exec_path, sizeof(graphics_exec_path))) continue;
if (xp.parse_str("web_graphics_url", web_graphics_url, sizeof(web_graphics_url))) continue;
- if (xp.parse_str("remote_desktop_connection", remote_desktop_connection, sizeof(remote_desktop_connection))) continue;
+ if (xp.parse_str("remote_desktop_addr", remote_desktop_addr, sizeof(remote_desktop_addr))) continue;
if (xp.parse_str("slot_path", slot_path, sizeof(slot_path))) continue;
if (xp.parse_str("resources", resources, sizeof(resources))) continue;
}
@@ -550,7 +550,7 @@ void RESULT::clear() {
strcpy(project_url, "");
strcpy(graphics_exec_path, "");
strcpy(web_graphics_url, "");
- strcpy(remote_desktop_connection, "");
+ strcpy(remote_desktop_addr, "");
strcpy(slot_path, "");
strcpy(resources, "");
report_deadline = 0;
diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp
index 6bc7dc95b7..1639f884e3 100644
--- a/samples/vboxwrapper/vboxwrapper.cpp
+++ b/samples/vboxwrapper/vboxwrapper.cpp
@@ -256,24 +256,19 @@ void set_remote_desktop_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) {
}
}
-// send dynamic settings to the core client
+// send graphics info to the client
//
-void send_application_settings(APP_INIT_DATA& /* aid */, VBOX_VM& vm) {
+void send_graphics_info(VBOX_VM& vm) {
char buf[256];
- std::string msg;
if (vm.pf_guest_port && vm.pf_host_port) {
- sprintf(buf, "http://localhost:%d\n", vm.pf_host_port);
- msg += buf;
+ sprintf(buf, "http://localhost:%d", vm.pf_host_port);
+ boinc_web_graphics_url(buf);
}
if (vm.rd_host_port) {
- sprintf(buf, "localhost:%d\n", vm.rd_host_port);
- msg += buf;
- }
-
- if (!msg.empty()) {
- boinc_send_settings_raw((char*)msg.c_str());
+ sprintf(buf, "localhost:%d", vm.rd_host_port);
+ boinc_remote_desktop_addr(buf);
}
}
@@ -423,49 +418,37 @@ int main(int argc, char** argv) {
fprintf(
stderr,
- "%s VM failed to startup!!!\n",
+ "%s VM failed to start.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
if ((vm_log.find("VERR_VMX_MSR_LOCKED_OR_DISABLED") != std::string::npos) || (vm_log.find("VERR_SVM_DISABLED") != std::string::npos)) {
fprintf(
stderr,
"%s NOTE: BOINC has detected that your processor supports hardware acceleration for virtual machines\n"
- "%s but the hypervisor failed to successfully launch with this feature enabled. This means that the\n"
- "%s hardware acceleration feature has been disabled in the computers BIOS. Please enable this\n"
- "%s feature in your BIOS.\n"
- "%s Intel Processors call it 'VT-x'\n"
- "%s AMD Processors call it 'AMD-V'\n"
- "%s More information can be found here: http://en.wikipedia.org/wiki/X86_virtualization\n"
- "%s Error Code: ERR_CPU_VM_EXTENSIONS_DISABLED\n",
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
+ " but the hypervisor failed to successfully launch with this feature enabled. This means that the\n"
+ " hardware acceleration feature has been disabled in the computers BIOS. Please enable this\n"
+ " feature in your BIOS.\n"
+ " Intel Processors call it 'VT-x'\n"
+ " AMD Processors call it 'AMD-V'\n"
+ " More information can be found here: http://en.wikipedia.org/wiki/X86_virtualization\n"
+ " Error Code: ERR_CPU_VM_EXTENSIONS_DISABLED\n",
boinc_msg_prefix(buf, sizeof(buf))
);
} else if ((vm_log.find("VERR_VMX_IN_VMX_ROOT_MODE") != std::string::npos) || (vm_log.find("VERR_SVM_IN_USE") != std::string::npos)) {
fprintf(
stderr,
"%s NOTE: VirtualBox hypervisor reports that another hypervisor has locked the hardware acceleration\n"
- "%s for virtual machines feature in exclusive mode. You'll either need to reconfigure the other hypervisor\n"
- "%s to not use the feature exclusively or just let BOINC run this project in software emulation mode.\n"
- "%s Error Code: ERR_CPU_VM_EXTENSIONS_DISABLED\n",
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
+ " for virtual machines feature in exclusive mode. You'll either need to reconfigure the other hypervisor\n"
+ " to not use the feature exclusively or just let BOINC run this project in software emulation mode.\n"
+ " Error Code: ERR_CPU_VM_EXTENSIONS_DISABLED\n",
boinc_msg_prefix(buf, sizeof(buf))
);
} else if ((vm_log.find("VERR_VMX_NO_VMX") != std::string::npos) || (vm_log.find("VERR_SVM_NO_SVM") != std::string::npos)) {
fprintf(
stderr,
"%s NOTE: VirtualBox has reported an improperly configured virtual machine. It was configured to require\n"
- "%s hardware acceleration for virtual machines, but your processor does not support the required feature.\n"
- "%s Please report this issue to the project so that it can be addresssed.\n",
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
+ " hardware acceleration for virtual machines, but your processor does not support the required feature.\n"
+ " Please report this issue to the project so that it can be addresssed.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
} else {
@@ -489,7 +472,7 @@ int main(int argc, char** argv) {
set_port_forwarding_info(aid, vm);
set_remote_desktop_info(aid, vm);
set_throttles(aid, vm);
- send_application_settings(aid, vm);
+ send_graphics_info(vm);
write_checkpoint(elapsed_time, vm);
while (1) {
@@ -520,34 +503,22 @@ int main(int argc, char** argv) {
if (vm.crashed || (elapsed_time < vm.job_duration)) {
fprintf(
stderr,
- "%s VM Premature Shutdown Detected!!!\n",
- "%s NOTE: This could be like a blue-screen event in Windows, the rest of the information in this file\n"
- "%s is diagnostic information generated by the hypervisor.\n"
- "%s Hypervisor System Log:\n\n"
+ "%s VM Premature Shutdown Detected.\n"
+ " Hypervisor System Log:\n\n"
"%s\n"
- "%s VM Execution Log:\n\n"
+ " VM Execution Log:\n\n"
"%s\n",
boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
- boinc_msg_prefix(buf, sizeof(buf)),
system_log.c_str(),
- boinc_msg_prefix(buf, sizeof(buf)),
vm_log.c_str()
);
+ boinc_finish(EXIT_ABORTED_BY_CLIENT);
} else {
fprintf(
stderr,
- "%s Virtual machine is no longer running, it must have completed its work.\n"
- "%s NOTE: If this is in error, check the vboxwrapper source code for additional steps to debug this issue.\n",
- boinc_msg_prefix(buf, sizeof(buf)),
+ "%s Virtual machine exited.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
- }
-
- if (vm.crashed || (elapsed_time < vm.job_duration)) {
- boinc_finish(EXIT_ABORTED_BY_CLIENT);
- } else {
boinc_finish(0);
}
}