aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHomer Horwitz2008-10-22 17:06:23 +0000
committerHomer Horwitz2008-10-22 17:06:23 +0000
commit80689c98b4eaa605c91eda6434f51b625c143915 (patch)
treebc5844151e45123015cce33d8223748c8bb668e4
parentThank you kindly, Nlin for a patch that: (diff)
downloadopensim-SC_OLD-80689c98b4eaa605c91eda6434f51b625c143915.zip
opensim-SC_OLD-80689c98b4eaa605c91eda6434f51b625c143915.tar.gz
opensim-SC_OLD-80689c98b4eaa605c91eda6434f51b625c143915.tar.bz2
opensim-SC_OLD-80689c98b4eaa605c91eda6434f51b625c143915.tar.xz
- Added BaseHttpServer.Stop
- Added "register" command to MessagingServer to re-register with the UserServer after that crashed/was restarted.
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs5
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs55
2 files changed, 39 insertions, 21 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 18bb018..7e8130a 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -1357,6 +1357,11 @@ namespace OpenSim.Framework.Servers
1357 } 1357 }
1358 } 1358 }
1359 1359
1360 public void Stop()
1361 {
1362 m_httpListener2.Stop();
1363 }
1364
1360 public void RemoveStreamHandler(string httpMethod, string path) 1365 public void RemoveStreamHandler(string httpMethod, string path)
1361 { 1366 {
1362 string handlerKey = GetHandlerKey(httpMethod, path); 1367 string handlerKey = GetHandlerKey(httpMethod, path);
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 537cc48..c188654 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Grid.MessagingServer
54 { 54 {
55 XmlConfigurator.Configure(); 55 XmlConfigurator.Configure();
56 56
57 m_log.Info("Launching MessagingServer..."); 57 m_log.Info("[SERVER]: Launching MessagingServer...");
58 58
59 OpenMessage_Main messageserver = new OpenMessage_Main(); 59 OpenMessage_Main messageserver = new OpenMessage_Main();
60 60
@@ -78,38 +78,46 @@ namespace OpenSim.Grid.MessagingServer
78 } 78 }
79 } 79 }
80 80
81 protected override void StartupSpecific() 81 private void registerWithUserServer()
82 { 82 {
83 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml")));
84
85 m_log.Info("[REGION]: Starting HTTP process");
86 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
87
88 msgsvc = new MessageService(Cfg);
89
90 if (msgsvc.registerWithUserServer()) 83 if (msgsvc.registerWithUserServer())
91 { 84 {
85 m_log.Info("[SERVER]: Starting HTTP process");
86 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
87
92 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); 88 m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
93 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff); 89 m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
94 //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
95 //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
96 //httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
97 //httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend);
98 //httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
99 //httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
100 //httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
101
102
103 //httpServer.AddStreamHandler(
104 //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
105 90
106 m_httpServer.Start(); 91 m_httpServer.Start();
107 m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); 92 m_log.Info("[SERVER]: Userserver registration was successful");
108 } 93 }
109 else 94 else
110 { 95 {
111 m_log.Error("[STARTUP]: Unable to connect to User Server"); 96 m_log.Error("[STARTUP]: Unable to connect to User Server");
112 } 97 }
98
99 }
100
101 private void deregisterFromUserServer()
102 {
103 msgsvc.deregisterWithUserServer();
104 if(m_httpServer != null)
105 {
106 // try a completely fresh registration, with fresh handlers, too
107 m_httpServer.Stop();
108 m_httpServer = null;
109 }
110 m_console.Notice("[SERVER]: Deregistered from userserver.");
111 }
112
113 protected override void StartupSpecific()
114 {
115 Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml")));
116
117 msgsvc = new MessageService(Cfg);
118 registerWithUserServer();
119
120 m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
113 } 121 }
114 122
115 public void do_create(string what) 123 public void do_create(string what)
@@ -150,6 +158,10 @@ namespace OpenSim.Grid.MessagingServer
150 int entries = msgsvc.ClearRegionCache(); 158 int entries = msgsvc.ClearRegionCache();
151 m_console.Notice("Region cache cleared! Cleared " + entries.ToString() + " entries"); 159 m_console.Notice("Region cache cleared! Cleared " + entries.ToString() + " entries");
152 break; 160 break;
161 case "register":
162 deregisterFromUserServer();
163 registerWithUserServer();
164 break;
153 } 165 }
154 } 166 }
155 167
@@ -158,6 +170,7 @@ namespace OpenSim.Grid.MessagingServer
158 base.ShowHelp(helpArgs); 170 base.ShowHelp(helpArgs);
159 171
160 m_console.Notice("clear-cache - Clears region cache. Should be done when regions change position. The region cache gets stale after a while."); 172 m_console.Notice("clear-cache - Clears region cache. Should be done when regions change position. The region cache gets stale after a while.");
173 m_console.Notice("register - (Re-)registers with user-server. This might be necessary if the userserver crashed/restarted");
161 } 174 }
162 175
163 protected override void ShutdownSpecific() 176 protected override void ShutdownSpecific()