Hi,

Patch for :
Use the HomeServer information in the currentserver. Talk to master only
if the user is not provisioned. Improves Fault tolerance.

Please review.

Thanks,
Johnny
Index: src/webservices/ChangeLog
===================================================================
--- src/webservices/ChangeLog	(revision 6633)
+++ src/webservices/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-12-22  Johnny Jacob  <[EMAIL PROTECTED]>
+
+	* iFolderServer.cs (GetHomeServerForUser) : Talk to Master only if
+	the user doesnt have a HomeServer.
+	
 2006-12-15  Johnny Jacob  <[EMAIL PROTECTED]>	
 
 	* LastSyncInfo.cs : MonthsOfYear. Added missing 'May'
Index: src/webservices/iFolderServer.cs
===================================================================
--- src/webservices/iFolderServer.cs	(revision 6632)
+++ src/webservices/iFolderServer.cs	(working copy)
@@ -219,21 +219,42 @@
 //
 		        string publicUrl;
 			try
-			{
-			        iFolderServer MasterServer = GetMasterServer();
-			        DomainService domainService = new DomainService();
+			{
+			        Store store = Store.GetStore();
+				Domain domain = store.GetDomain(store.DefaultDomain);
 
-				domainService.Url = MasterServer.PublicUrl + "/DomainService.asmx";
-				domainService.Credentials = new NetworkCredential(username, password);
-				domainService.PreAuthenticate = true;
+				// find user
+				Member member = domain.GetMemberByName( username );
 
-				publicUrl = domainService.GetHomeServer( username ).PublicAddress;
+				if (member == null) throw new UserDoesNotExistException( username );
+
+				HostNode hNode = member.HomeServer;
+
+				if ( hNode == null )
+				{
+				        //User still not provisioned. Talk to Master Server.
+				        //Note : User provisioning is done only in master!!
+
+				        iFolderServer MasterServer = GetMasterServer();
+					DomainService domainService = new DomainService();
+
+					domainService.Url = MasterServer.PublicUrl + "/DomainService.asmx";
+					domainService.Credentials = new NetworkCredential(username, password);
+					domainService.PreAuthenticate = true;
+
+					publicUrl = domainService.GetHomeServer( username ).PublicAddress;
+				} else {
+				        //Yay!! User already provisioned.
+				        publicUrl = hNode.PublicUrl;
+				}
+
 
 			}
 			catch ( Exception ex )
 			{
 			        throw (ex);
 			}
+
 			return publicUrl;
 		}
 
_______________________________________________
ifolder-dev mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/ifolder-dev

Reply via email to