* HttpHelper.cs: Removed usnused method GetMachineIp.
authorLluis Sanchez <lluis@novell.com>
Sun, 16 Nov 2003 21:56:13 +0000 (21:56 -0000)
committerLluis Sanchez <lluis@novell.com>
Sun, 16 Nov 2003 21:56:13 +0000 (21:56 -0000)
* HttpServerChannel.cs: Added support for priority, bindTo, useIpAddress and
  machineName properties.

svn path=/trunk/mcs/; revision=20075

mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs

index 99e3fc2c1121dec323e451e3cd6d3691aa90b111..7f3ae9d6013fb1f2b4a05fd0d896f4b56322174c 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-16  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * HttpHelper.cs: Removed usnused method GetMachineIp.
+       * HttpServerChannel.cs: Added support for priority, bindTo, useIpAddress and
+         machineName properties.
+
 2003-11-13  Lluis Sanchez Gual <lluis@ximian.com>
 
        * HttpChannel.cs: Create empty property dictionary in the default
index fc6b128703b806af667f15c6f0bf63322b7b6166..c3bb4e108782b1503874a6289fe0e55d605e6d32 100644 (file)
@@ -134,24 +134,5 @@ namespace System.Runtime.Remoting.Channels.Http
                                    
                        return machineName;      
                } 
-
-               public static String GetMachineIp()
-               {
-                       
-                       String hostName = GetMachineName();
-                       String MachineIp=null;
-
-                       IPHostEntry Entries = Dns.GetHostByName(hostName);
-                       if ((Entries.AddressList.Length > 0)&&(Entries != null))
-                       {
-                               MachineIp = Entries.AddressList[0].ToString();
-                       }               
-
-                       if (MachineIp == null)
-                       {
-                               throw new ArgumentNullException("ip");
-                       }               
-                       return MachineIp;      
-               } 
        }
 }
index a8d9c3a8acb9a6c17c84bc16eb63ef0c3fd19989..682ed3d0cfd72aa2bf16cb947549ce1d3d99381f 100644 (file)
@@ -34,13 +34,12 @@ namespace System.Runtime.Remoting.Channels.Http
        public class HttpServerChannel : IChannel,
                IChannelReceiver, IChannelReceiverHook
        {
-               private int                 _channelPriority = 1;  // priority of channel (default=1)
+               private int               _channelPriority = 1;  // priority of channel (default=1)
                private String            _channelName = "http"; // channel name
                private String            _machineName = null;   // machine name
                private int               _port = -1;            // port to listen on
                private ChannelDataStore  _channelData = null;   // channel data
                
-               private String  _forcedMachineName = null; // an explicitly configured machine name
                private bool _bUseIpAddress = true; // by default, we'll use the ip address.
                private IPAddress _bindToAddr = IPAddress.Any; // address to bind to.
                private bool _bSuppressChannelData = false; // should we hand out null for our channel data
@@ -95,6 +94,9 @@ namespace System.Runtime.Remoting.Channels.Http
                                        case "name":
                                                _channelName = (string)Dict.Value;
                                                break;
+                                       case "priority":
+                                               _channelPriority = Convert.ToInt32 (Dict.Value);
+                                               break;
                                        case "bindTo": 
                                                _bindToAddr = IPAddress.Parse ((string)Dict.Value); 
                                                break;
@@ -197,32 +199,17 @@ namespace System.Runtime.Remoting.Channels.Http
                
                void SetupMachineName()
                {
-                       if (_forcedMachineName != null)
+                       if (_machineName == null)
                        {
-                               // an explicitly configured machine name was used
-                               //_machineName = CoreChannel.DecodeMachineName(_forcedMachineName);
-                               if (_forcedMachineName.Equals("$hostName"))
-                               {
-                                       _machineName =  Dns.GetHostName();
-                                       if(_machineName == null)
-                                                       throw new ArgumentNullException("hostName");
-                                       
+                               if (_bUseIpAddress) {
+                                       IPHostEntry he = Dns.Resolve (Dns.GetHostName());
+                                       if (he.AddressList.Length == 0) throw new RemotingException ("IP address could not be determined for this host");
+                                       _machineName = he.AddressList [0].ToString ();
                                }
-
-                               else _machineName = _forcedMachineName;
-                       }
-                       else
-                       {
-                               if (!_bUseIpAddress)
-                                       _machineName = HttpHelper.GetMachineName();
                                else
-                               {
-                                       if (_bindToAddr == IPAddress.Any)
-                                               _machineName = HttpHelper.GetMachineIp();
-                                       else
-                                               _machineName = _bindToAddr.ToString();
-                               }
+                                       _machineName = Dns.GetHostByName(Dns.GetHostName()).HostName;
                        }
+                       
                } // SetupMachineName