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-server | |
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-server')
-rwxr-xr-x | stap-server | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/stap-server b/stap-server index b82bc695..67573de7 100755 --- a/stap-server +++ b/stap-server @@ -47,29 +47,26 @@ function initialization { # function: receive_request # # Receive a tar file representing the request from the client: -# The protocol is: -# client -> "request:" -# client -> $tar_client function receive_request { - # Request from the client is on stdin - read - line=$REPLY - - # Check to see that it is a client request - test "$line" = "request:" || \ - fatal "ERROR: client request, '$line' is incorrect" - # Create a place to receive the client's tar file tar_client=`mktemp -t $tmpdir_prefix_server.client.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary tar file " $tar_client - # Receive 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. - nc -l $port < /dev/zero > $tar_client & + # Receive the file. + nc -ld $port > $tar_client 2>/dev/null & + + # Wait for 10 seconds before timing out + for ((t=0; $t < 10; ++t)) + do + if jobs '%nc -l' >/dev/null 2>&1; then + sleep 1 + else + return + fi + done - # Wait for the transfer to complete. - wait '%nc' >/dev/null 2>&1 + # We have timed out. fatal will kill the job. + fatal "Timed out waiting for client request file" } # function: unpack_request @@ -386,11 +383,21 @@ function package_response { # # Wait for the client to take the response file. function send_response { - # Now send it. 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. - nc -l $port < $tar_server > /dev/null & - wait '%nc' >/dev/null 2>&1 + # Now send it. + nc -l $port < $tar_server > /dev/null 2>&1 & + + # Wait for 10 seconds before timing out + for ((t=0; $t < 10; ++t)) + do + if jobs '%nc -l' >/dev/null 2>&1; then + sleep 1 + else + return + fi + done + + # We have timed out. fatal will kill the job. + fatal "Timed out waiting to send response file" } # function: fatal [ MESSAGE ] |