From 35b8b74001e7fc369726678a3d719d6f4a618ec4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 30 Sep 2004 21:41:09 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4272 --- checkin_notes | 18 +++++++++++++++- client/client_msgs.C | 11 ++++++---- client/client_msgs.h | 2 +- client/gui_rpc_server.C | 34 +++++++++++++++--------------- lib/boinc_win.h | 1 + lib/gui_rpc_client.C | 5 ++--- lib/gui_rpc_client.h | 2 +- lib/gui_test.C | 5 ++--- win_build/boinc_guirpc_test.vcproj | 6 +++--- 9 files changed, 51 insertions(+), 33 deletions(-) diff --git a/checkin_notes b/checkin_notes index 02bba80356..77be8b6ea7 100755 --- a/checkin_notes +++ b/checkin_notes @@ -17889,9 +17889,25 @@ David 30 Sept 2004 mail_passwd.php David 30 Sept 2004 - - got clientgui to work on Linux!! + - got clientgui working on Linux!! clientgui/ MainDocument.cpp Makefile (new) ValidateURL.cpp + +David 30 Sept 2004 + - changed the semantics of the GUI RPC get_messages() call. + - It no longer takes an "nmessages" arg. + - it returns messages in order of increasing seqno + - changed message_descs from a std::list to a std::deque + + client/ + client_msgs.C,h + gui_rpc_server.C + lib/ + boinc_win.h + gui_rpc_client.C,h + gui_test.C + win_build/ + boinc_guirpc_test.vcproj diff --git a/client/client_msgs.C b/client/client_msgs.C index 84e4e3bce2..3dfacb1423 100644 --- a/client/client_msgs.C +++ b/client/client_msgs.C @@ -22,14 +22,14 @@ #endif #ifndef _WIN32 #include -#include +#include #endif +using std::deque; + #include "log_flags.h" #include "client_msgs.h" -using std::list; - #define MAX_SAVED_MESSAGES 1000 CLIENT_MSG_LOG log_messages; @@ -68,7 +68,10 @@ bool CLIENT_MSG_LOG::v_message_wanted(int kind) const { } } -list message_descs; +// a dequeue of up to MAX_SAVED_MESSAGES most recent messages, +// stored in newest-first order +// +deque message_descs; // Takes a printf style formatted string, inserts the proper values, // and passes it to show_message diff --git a/client/client_msgs.h b/client/client_msgs.h index 0de5f3b8f7..dbaeb02617 100644 --- a/client/client_msgs.h +++ b/client/client_msgs.h @@ -59,7 +59,7 @@ struct MESSAGE_DESC { std::string message; }; -extern std::list message_descs; +extern std::deque message_descs; extern void record_message(class PROJECT *p, int priority, int now, char* msg); extern void show_message(class PROJECT *p, char* message, int priority); diff --git a/client/gui_rpc_server.C b/client/gui_rpc_server.C index da85d7d6dc..e951be3946 100644 --- a/client/gui_rpc_server.C +++ b/client/gui_rpc_server.C @@ -264,30 +264,30 @@ static void handle_get_proxy_settings(char* , MIOFILE& fout) { } // params: -// x -// return at most this many messages -// n -// start at message n. -// if no offset is given, return last n messages +// [ n ] +// start at message seqno n; if absent or zero, return all // void handle_get_messages(char* buf, MIOFILE& fout) { - int nmessages=-1, seqno=-1, j; + int seqno=0, j; + unsigned int i; + MESSAGE_DESC* mdp; + bool found=false; - parse_int(buf, "", nmessages); parse_int(buf, "", seqno); - if (nmessages < 0) { - fout.printf("No nmessages given\n"); - return; + + j = message_descs.size()-1; + for (i=0; iseqno <= seqno) { + found = true; + j = i; + break; + } } fout.printf("\n"); - list::const_iterator iter; - for (iter=message_descs.begin(), j=0; - iter != message_descs.end() && jseqno <= seqno) break; + for (i=j; i>=0; i--) { + mdp = message_descs[i]; fout.printf( "\n" " %d\n" diff --git a/lib/boinc_win.h b/lib/boinc_win.h index e1d61ca4e4..d16a18e99a 100644 --- a/lib/boinc_win.h +++ b/lib/boinc_win.h @@ -106,6 +106,7 @@ #include #include #include +#include #include #include diff --git a/lib/gui_rpc_client.C b/lib/gui_rpc_client.C index 481da9e4e4..00132b91d9 100644 --- a/lib/gui_rpc_client.C +++ b/lib/gui_rpc_client.C @@ -1104,17 +1104,16 @@ int RPC_CLIENT::set_proxy_settings(PROXY_INFO& pi) { return rpc.do_rpc(buf); } -int RPC_CLIENT::get_messages( int nmessages, int seqno, MESSAGES& msgs) { +int RPC_CLIENT::get_messages(int seqno, MESSAGES& msgs) { char buf[4096]; RPC rpc(this); int retval; sprintf(buf, "\n" - " %d\n" " %d\n" "\n", - nmessages, seqno + seqno ); retval = rpc.do_rpc(buf); if (retval) return retval; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 349e988bac..cb5fe6e38b 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -304,7 +304,7 @@ public: int run_benchmarks(); int set_proxy_settings(PROXY_INFO&); int get_proxy_settings(PROXY_INFO&); - int get_messages(int nmessages, int seqno, MESSAGES&); + int get_messages(int seqno, MESSAGES&); int file_transfer_op(FILE_TRANSFER&, char*); int result_op(RESULT&, char*); char* mode_name(int mode); diff --git a/lib/gui_test.C b/lib/gui_test.C index 136ddf4c1f..5340ecee99 100644 --- a/lib/gui_test.C +++ b/lib/gui_test.C @@ -94,10 +94,9 @@ int main(int argc, char** argv) { FILE_TRANSFERS ft; retval = rpc.get_file_transfers(ft); } else if (!strcmp(argv[i], "-get_messages")) { - if (i != argc-3) usage(); - int nmsgs = atoi(argv[++i]); + if (i != argc-2) usage(); int seqno = atoi(argv[++i]); - retval = rpc.get_messages(nmsgs, seqno, messages); + retval = rpc.get_messages(seqno, messages); if (!retval) { for (i=0; i + RelativePath="..\lib\gui_rpc_client.C"> + RelativePath="..\lib\gui_test.C"> @@ -213,7 +213,7 @@ RelativePath="..\lib\filesys.h"> + RelativePath="..\lib\gui_rpc_client.h">