diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-28 14:44:06 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-28 14:44:06 -0400 |
commit | 30f926f0b0a198dd416ea735353e852a7ee79d69 (patch) | |
tree | 7c924e8de6a9a38ee904d9793f0bafffc00b8d85 /stap-client | |
parent | fb84c077272764f8cb000e9b02572fb7c9cac24f (diff) | |
parent | 84f00e279d98edba986225386c7183db3c5968b0 (diff) | |
download | systemtap-steved-30f926f0b0a198dd416ea735353e852a7ee79d69.tar.gz systemtap-steved-30f926f0b0a198dd416ea735353e852a7ee79d69.tar.xz systemtap-steved-30f926f0b0a198dd416ea735353e852a7ee79d69.zip |
Merge commit 'origin/master' into pr4225
* commit 'origin/master':
PR5686: correct regression in semok/optimize.stp
trailing whitespace removal, as approved by emacs
fix global-var array index rendering
fix NEWS to refer to simpler context.stp tapset functions in auto-printing blurb
Document written but unread global variable automatic display.
2nd try
initial
Make _get_sock_addr return correct address in kernel before 2.6.16.
Automatically print written but unread globals
Make nodwf test passed when CONFIG_QUOTACTL unset
Uses STAPCONF_DPATH_PATH instead of a kernel version check.
Simplified "rpm" target a bit.
Moved tar archive creation step from "rpm" target to "dist-gzip" target.
remove support for "make dist" since git-archive does as well;
Examples html files moved into subdir.
2008-08-25 David Smith <dsmith@redhat.com>
ChangeLog Entries
Robustness improvements for the stap client/server
Diffstat (limited to 'stap-client')
-rwxr-xr-x | stap-client | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/stap-client b/stap-client index 3fa397a7..f4ccb033 100755 --- a/stap-client +++ b/stap-client @@ -102,8 +102,10 @@ function parse_options { script_file=$first_token cmdline1="$cmdline2" cmdline2= - else + elif test "$first_char" != "'"; then cmdline2="$cmdline2 '$first_token'" + else + cmdline2="$cmdline2 $first_token" fi advance_p=$(($advance_p + 1)) break @@ -381,13 +383,15 @@ function package_request { # client -> "request:" # client -> $tar_client function send_request { - # Send the request file. We need to redirect to /dev/null - # in order to workaround a nc bug. It closes the connection - # early if stdin from the other side is not provided. - until nc $server $(($port + 1)) < $tar_client > /dev/null + # Send the request file. + for ((attempt=0; $attempt < 10; ++attempt)) do + if nc -w10 $server $(($port+1)) < $tar_client > /dev/null 2>&1; then + return; + fi sleep 1 done + fatal "ERROR: Unable to connect to server while sending request file" } # function: receive_response @@ -398,13 +402,15 @@ function receive_response { tar_server=`mktemp -t $tmpdir_prefix_client.server.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary file " $tar_server - # Retrieve the file. We need to redirect stdin from /dev/zero to work - # around a bug in nc. It closes the connection early is stdin is not - # provided. - until nc $server $(($port + 1)) < /dev/zero > $tar_server + # Retrieve the file. Wait for up to 5 minutes for a response. + for ((attempt=0; $attempt < 300; ++attempt)) do + if nc -d $server $(($port+1)) > $tar_server 2>/dev/null; then + return; + fi sleep 1 done + fatal "ERROR: Unable to connect to server while receiving response file" } # function: unpack_response @@ -516,8 +522,8 @@ function choose_server { fi done - if test num_servers = 0; then - fatal "ERROR: cannot find a server" + if test $num_servers = 0; then + fatal "ERROR: unable to find a server" fi fatal "ERROR: unable to connect to a server" @@ -527,10 +533,15 @@ function choose_server { # # Establish connection with the given server function connect_to_server { - until echo "request:" | nc $1 $2 > /dev/null + for ((attempt=0; $attempt < 10; ++attempt)) do + if echo "request:" | nc -w10 $1 $2 >/dev/null 2>&1; then + return 0 + fi sleep 1 done + + return 1 } # function: disconnect_from_server |