2012-11-18, 18:19
Hi, I noticed a bug in how XBMC handles multiple shares when more than 1 NFS server is involved. This is probably only an issue on systems where the netbios lookup of the host name isn't available (OS X. iOS, Windows). Example:
I have 2 video shares added in XBMC: "Movies NAS" and "Movies MacMini". They are both added using the servers' host name (as opposed to IP-address). Only 1 of them works. The share which isn't working is trying to access the working server's export.
Poorly explained example, I know. Maybe explaining the fix will make it clearer.
The CNfsConnection class is persisting the resolved IP address of the last used host. When it goes to resolve a new host name, it sends the resolved IP address as an argument to CDNSNameCache::Lookup, which in some cases will return if it's non-empty (the logic assumes it has been successfully resolved if it's non-empty).
The following patch fixes the issue:
Moving CDNSNameCache::Lookup(url.GetHostName(), m_resolvedHostName) into the if-statement is probably ok.
I'm not sure how CDNSNameCache::Lookup is supposed to behave, but maybe always clearing strIpAddress in there is a better fix than the above (although riskier...).
Hope someone more git savvy than me can fix this.
I have 2 video shares added in XBMC: "Movies NAS" and "Movies MacMini". They are both added using the servers' host name (as opposed to IP-address). Only 1 of them works. The share which isn't working is trying to access the working server's export.
Poorly explained example, I know. Maybe explaining the fix will make it clearer.
The CNfsConnection class is persisting the resolved IP address of the last used host. When it goes to resolve a new host name, it sends the resolved IP address as an argument to CDNSNameCache::Lookup, which in some cases will return if it's non-empty (the logic assumes it has been successfully resolved if it's non-empty).
The following patch fixes the issue:
Code:
diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp
index 9fc26b0..fb486fb 100644
--- a/xbmc/filesystem/NFSFile.cpp
+++ b/xbmc/filesystem/NFSFile.cpp
@@ -78,6 +78,10 @@ CNfsConnection::~CNfsConnection()
void CNfsConnection::resolveHost(const CURL &url)
{
//resolve if hostname has changed
+ if(url.GetHostName() != m_resolvedHostName)
+ {
+ m_resolvedHostName.clear();
+ }
CDNSNameCache::Lookup(url.GetHostName(), m_resolvedHostName);
}
Moving CDNSNameCache::Lookup(url.GetHostName(), m_resolvedHostName) into the if-statement is probably ok.
I'm not sure how CDNSNameCache::Lookup is supposed to behave, but maybe always clearing strIpAddress in there is a better fix than the above (although riskier...).
Hope someone more git savvy than me can fix this.