HDFS-4496. DFSClient: don't create a domain socket unless we need it. Contributed by Colin Patrick McCabe.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-347@1445491 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2013-02-13 07:26:42 +00:00
parent aa92072b54
commit 27e158362c
2 changed files with 6 additions and 0 deletions

View File

@ -45,3 +45,5 @@ HDFS-4473. Don't create domain socket unless we need it. (Colin Patrick McCabe v
HDFS-4485. DN should chmod socket path a+w. (Colin Patrick McCabe via atm)
HDFS-4453. Make a simple doc to describe the usage and design of the shortcircuit read feature. (Colin Patrick McCabe via atm)
HDFS-4496. DFSClient: don't create a domain socket unless we need it (Colin Patrick McCabe via todd)

View File

@ -85,6 +85,10 @@ DomainSocket create(InetSocketAddress addr, DFSInputStream stream) {
// If there is no domain socket path configured, we can't use domain
// sockets.
if (conf.domainSocketPath.isEmpty()) return null;
// If we can't do anything with the domain socket, don't create it.
if (!(conf.domainSocketDataTraffic || conf.shortCircuitLocalReads)) {
return null;
}
// UNIX domain sockets can only be used to talk to local peers
if (!DFSClient.isLocalAddress(addr)) return null;
// If the DomainSocket code is not loaded, we can't create