From: Zoran V. <vas...@us...> - 2006-07-25 09:11:14
|
Update of /cvsroot/naviserver/naviserver/nsproxy In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20358/nsproxy Modified Files: ns_proxy.man nsproxylib.c Log Message: Improved error codes (made them match the nsproxy module from AS). Added [ns_proxy send] [ns_proxy wait] and [ns_proxy recv] and made the [ns_proxy eval] wrap those three. Adjusted test suite. Index: nsproxylib.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsproxy/nsproxylib.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nsproxylib.c 14 Jun 2006 13:55:55 -0000 1.9 --- nsproxylib.c 25 Jul 2006 09:11:06 -0000 1.10 *************** *** 87,90 **** --- 87,96 ---- */ + typedef enum { + Idle, /* Ready to receive a script */ + Busy, /* Evaluating a script */ + Done /* Result is pending */ + } ProxyState; + typedef struct Proxy { [...1425 lines suppressed...] + code = "EInit"; + msg = "init script failed"; + break; + case EDead: + code = "EDead"; + msg = "child process died"; + break; + case ENoWait: + code = "ENoWait"; + msg = "no wait for script result"; + break; + case EBusy: + code = "EBusy"; + msg = "currently evaluating a script"; + break; + } + + Tcl_SetErrorCode(interp, "NSPROXY", code, msg, sysmsg, NULL); + return msg; + } Index: ns_proxy.man =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsproxy/ns_proxy.man,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ns_proxy.man 13 May 2006 09:45:20 -0000 1.2 --- ns_proxy.man 25 Jul 2006 09:11:06 -0000 1.3 *************** *** 202,207 **** as needed. ! [call [cmd "ns_proxy eval"] [arg handle] [opt timeout]] Evalutes [arg script] in the proxy specified by [arg handle]. The optional [opt timeout] argument specifies a maximum number of --- 202,221 ---- as needed. + [call [cmd "ns_proxy send"] [arg handle] [arg script]] + Sends [arg script] to the proxy specified by [arg handle]. + (see ERROR HANDLING below for details on handling errors). ! [call [cmd "ns_proxy wait"] [arg handle] [opt timeout]] ! Waits for results from the proxy specified by [arg handle]. ! The optional [opt timeout] argument specifies a maximum number of ! milliseconds to wait for the command to complete before raising an ! error (see ERROR HANDLING below for details on handling errors). ! ! [call [cmd "ns_proxy recv"] [arg handle]] ! Reads result from the script from the proxy specified by [arg handle] ! (see ERROR HANDLING below for details on handling errors). ! ! ! [call [cmd "ns_proxy eval"] [arg handle] [arg script] [opt timeout]] Evalutes [arg script] in the proxy specified by [arg handle]. The optional [opt timeout] argument specifies a maximum number of *************** *** 224,228 **** cooresponding pool must be returned before any handles can be allocated again. Within NaviServer, a call to this routine is ! recommended for clarity but not stricting necessary. As described above, NaviServer installs a trace to release all handles at the end of every connection during interpreter deallocation. --- 238,242 ---- cooresponding pool must be returned before any handles can be allocated again. Within NaviServer, a call to this routine is ! recommended for clarity but not strictly necessary. As described above, NaviServer installs a trace to release all handles at the end of every connection during interpreter deallocation. *************** *** 248,288 **** [list_begin definitions] ! [lst_item [emph DEADLOCK]] The interpreter attempted to allocate handles from a pool from which it already owns one or more handles. ! [lst_item [emph EXEC]] The slave program specified by the [arg {-exec program}] option could not be started. ! [lst_item [emph INVALID]] The response from the proxy was invalid. ! [lst_item [emph RECVFAIL]] There was an error receiving the result from the slave process. ! [lst_item [emph SENDFAIL]] There was an error sending the script to the slave process. ! [lst_item [emph NOHANDLE]] ! No handles were available from the pool. The next element of ! [emph errorCode] is a string with more detail on the failure and ! will be one of the following: ! [list_begin definitions] ! [lst_item "queue timeout"] ! Timeout waiting behind other threads also allocating handles from ! the requested pool. ! [lst_item "pool disabled"] ! The maximum number of handles in the pool was set with the [arg -maxslaves] ! config option to 0. ! [lst_item "insufficient handles"] ! The maximum number of handles in the pool set with the [arg -maxslaves] ! config option was less than the requested number of handles. - [list_end] [list_end] --- 262,304 ---- [list_begin definitions] ! [lst_item [emph EDeadlock]] The interpreter attempted to allocate handles from a pool from which it already owns one or more handles. ! [lst_item [emph EExec]] The slave program specified by the [arg {-exec program}] option could not be started. ! [lst_item [emph EImport]] The response from the proxy was invalid. ! [lst_item [emph ERecv]] There was an error receiving the result from the slave process. ! [lst_item [emph ESend]] There was an error sending the script to the slave process. ! [lst_item [emph EGetTimeout]] ! Timeout while waiting to get a proxy handle from the pool. ! [lst_item [emph EEvalTimeout]] ! Timeout while waiting for the response from the proxy process after ! sending the command for evaluation. ! [lst_item [emph ERange]] ! Requested too many proxy handles from the pool ! [lst_item [emph EIdle]] ! Proxy is currently in the idle state. ! [lst_item [emph EInit]] ! Evaluation of the init script failed. ! ! [lst_item [emph EDead]] ! Proxy handle is currently not connected to any process. ! ! [lst_item [emph EBusy]] ! Proxy handle is currently busy with the evaluation. [list_end] |