aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs32
1 files changed, 29 insertions, 3 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 45b5a10..17fc58c 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Framework
54 /// </summary> 54 /// </summary>
55 public class Util 55 public class Util
56 { 56 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 private static uint nextXferID = 5000; 59 private static uint nextXferID = 5000;
60 private static Random randomClass = new Random(); 60 private static Random randomClass = new Random();
@@ -136,7 +136,7 @@ namespace OpenSim.Framework
136 float dx = a.X - b.X; 136 float dx = a.X - b.X;
137 float dy = a.Y - b.Y; 137 float dy = a.Y - b.Y;
138 float dz = a.Z - b.Z; 138 float dz = a.Z - b.Z;
139 return (dx*dx + dy*dy + dz*dz) < (amount*amount); 139 return (dx*dx + dy*dy + dz*dz) < (amount*amount);
140 } 140 }
141 141
142 /// <summary> 142 /// <summary>
@@ -975,7 +975,7 @@ namespace OpenSim.Framework
975 else 975 else
976 { 976 {
977 os = ReadEtcIssue(); 977 os = ReadEtcIssue();
978 } 978 }
979 979
980 if (os.Length > 45) 980 if (os.Length > 45)
981 { 981 {
@@ -1203,6 +1203,32 @@ namespace OpenSim.Framework
1203 return found.ToArray(); 1203 return found.ToArray();
1204 } 1204 }
1205 1205
1206 public static string ServerURI(string uri)
1207 {
1208 if (uri == string.Empty)
1209 return string.Empty;
1210
1211 // Get rid of eventual slashes at the end
1212 uri = uri.TrimEnd('/');
1213
1214 IPAddress ipaddr1 = null;
1215 string port1 = "";
1216 try
1217 {
1218 ipaddr1 = Util.GetHostFromURL(uri);
1219 }
1220 catch { }
1221
1222 try
1223 {
1224 port1 = uri.Split(new char[] { ':' })[2];
1225 }
1226 catch { }
1227
1228 // We tried our best to convert the domain names to IP addresses
1229 return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
1230 }
1231
1206 #region FireAndForget Threading Pattern 1232 #region FireAndForget Threading Pattern
1207 1233
1208 public static void FireAndForget(System.Threading.WaitCallback callback) 1234 public static void FireAndForget(System.Threading.WaitCallback callback)