Check if client and server are running on same machine. #610
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch checks to see if the client and the server are running on
the same machine. The client creates a temporary file that the server
then looks for. If the server finds the file, it knows it is on the
same machine as the client and it deletes the file. Next, if the
client detects that the file has been deleted by the server, it
assumes that it is running on the same machine as the server.
This check is necessary since a user may specify a remote host with
"-r" that actually points back to the same machine the client is on.
This commit uses tempfile.mkstemp() which was added in Python 2.3.
Functionally, this commit does nothing except add a debug message
about if the client and server are on the same machine. It also sets a
variable which contains this information for potential future use.
Potential future uses include...
If the TTL hack is removed, this can be used to print a error
message since running the client and server on the same machine would
no longer be supported.
If the TTL hack is continued, we could disable the hack when the
client and the server are on different machines.