From ce4650ecbb2a5da7ea4ea2b5ebe7844dc325bc3c Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 13 Jan 2012 15:21:00 +0000 Subject: [PATCH] - VBOX: Cleanup a few messages stating port numbers in the stderr spew. - VBOX: Send configuration settings in one message instead of piece meal. api/ boinc_api.cpp, .h samples/vboxwrapper vboxwrapper.cpp svn path=/trunk/boinc/; revision=25041 --- api/boinc_api.cpp | 5 +++++ api/boinc_api.h | 1 + checkin_notes | 8 +++++++ samples/vboxwrapper/vbox.cpp | 5 ----- samples/vboxwrapper/vboxwrapper.cpp | 34 +++++++++++++++++++---------- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index bf0c8b9693..a76182b4f6 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -1463,3 +1463,8 @@ void boinc_remote_desktop_connection(char* connection) { 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); +} diff --git a/api/boinc_api.h b/api/boinc_api.h index 0470a0aff7..800793b4ed 100644 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -119,6 +119,7 @@ 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*); #ifdef __APPLE__ extern int setMacPList(void); diff --git a/checkin_notes b/checkin_notes index 82fc377cfb..9a4a66fd31 100644 --- a/checkin_notes +++ b/checkin_notes @@ -450,3 +450,11 @@ Charlie 13 Jan 2012 client/ hostinfo_unix.cpp +Rom 13 Jan 2012 + - VBOX: Cleanup a few messages stating port numbers in the stderr spew. + - VBOX: Send configuration settings in one message instead of piece meal. + + api/ + boinc_api.cpp, .h + samples/vboxwrapper + vboxwrapper.cpp diff --git a/samples/vboxwrapper/vbox.cpp b/samples/vboxwrapper/vbox.cpp index 21aa583298..9a212f65ca 100644 --- a/samples/vboxwrapper/vbox.cpp +++ b/samples/vboxwrapper/vbox.cpp @@ -1321,11 +1321,6 @@ int VBOX_VM::get_process_id(int& process_id) { return ERR_NOT_FOUND; } process_id = atol(pid.c_str()); - if (process_id) { - fprintf(stderr, "%s Virtual Machine PID %d Detected\n", - boinc_msg_prefix(buf, sizeof(buf)), process_id - ); - } return 0; } diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index c235ec6d97..7dd990225a 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -216,12 +216,6 @@ void set_port_forwarding_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) { char buf[256]; if (vm.pf_guest_port && vm.pf_host_port) { - fprintf( - stderr, - "%s port forwarding enabled on port '%d'.\n", - boinc_msg_prefix(buf, sizeof(buf)), vm.pf_host_port - ); - // Write info to disk // MIOFILE mf; @@ -251,12 +245,6 @@ void set_remote_desktop_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) { char buf[256]; if (vm.rd_host_port) { - fprintf( - stderr, - "%s remote desktop enabled on port '%d'.\n", - boinc_msg_prefix(buf, sizeof(buf)), vm.rd_host_port - ); - // Write info to disk // MIOFILE mf; @@ -276,6 +264,27 @@ void set_remote_desktop_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) { } } +// send dynamic settings to the core client +// +void send_application_settings(APP_INIT_DATA& /* aid */, 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; + } + + 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()); + } +} + int main(int argc, char** argv) { int retval; BOINC_OPTIONS boinc_options; @@ -488,6 +497,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); write_checkpoint(elapsed_time, vm); while (1) {