diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 37 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/MessageService.cs | 104 |
2 files changed, 128 insertions, 13 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 6ac70f0..5a383ef 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -44,6 +44,7 @@ namespace OpenSim.Grid.MessagingServer | |||
44 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private MessageServerConfig Cfg; | 46 | private MessageServerConfig Cfg; |
47 | private MessageService msgsvc; | ||
47 | 48 | ||
48 | //public UserManager m_userManager; | 49 | //public UserManager m_userManager; |
49 | //public UserLoginService m_loginService; | 50 | //public UserLoginService m_loginService; |
@@ -57,6 +58,8 @@ namespace OpenSim.Grid.MessagingServer | |||
57 | 58 | ||
58 | m_log.Info("Launching MessagingServer..."); | 59 | m_log.Info("Launching MessagingServer..."); |
59 | 60 | ||
61 | |||
62 | |||
60 | OpenMessage_Main messageserver = new OpenMessage_Main(); | 63 | OpenMessage_Main messageserver = new OpenMessage_Main(); |
61 | 64 | ||
62 | messageserver.Startup(); | 65 | messageserver.Startup(); |
@@ -85,23 +88,32 @@ namespace OpenSim.Grid.MessagingServer | |||
85 | 88 | ||
86 | m_log.Info("[REGION]: Starting HTTP process"); | 89 | m_log.Info("[REGION]: Starting HTTP process"); |
87 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); | 90 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); |
91 | |||
92 | msgsvc = new MessageService(Cfg); | ||
88 | 93 | ||
89 | //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 94 | if (msgsvc.registerWithUserServer()) |
95 | { | ||
96 | httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn); | ||
90 | 97 | ||
91 | //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 98 | //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
92 | //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 99 | //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
93 | //httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar); | 100 | //httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar); |
94 | //httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend); | 101 | //httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend); |
95 | //httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); | 102 | //httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); |
96 | //httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); | 103 | //httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); |
97 | //httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); | 104 | //httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); |
98 | |||
99 | 105 | ||
100 | //httpServer.AddStreamHandler( | 106 | |
107 | //httpServer.AddStreamHandler( | ||
101 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | 108 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); |
102 | 109 | ||
103 | httpServer.Start(); | 110 | httpServer.Start(); |
104 | m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); | 111 | m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); |
112 | } | ||
113 | else | ||
114 | { | ||
115 | m_log.Error("[STARTUP]: Unable to connect to User Server"); | ||
116 | } | ||
105 | } | 117 | } |
106 | 118 | ||
107 | public void do_create(string what) | 119 | public void do_create(string what) |
@@ -144,6 +156,7 @@ namespace OpenSim.Grid.MessagingServer | |||
144 | break; | 156 | break; |
145 | 157 | ||
146 | case "shutdown": | 158 | case "shutdown": |
159 | msgsvc.deregisterWithUserServer(); | ||
147 | m_console.Close(); | 160 | m_console.Close(); |
148 | Environment.Exit(0); | 161 | Environment.Exit(0); |
149 | break; | 162 | break; |
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 059a6b0..42277e2 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs | |||
@@ -333,7 +333,7 @@ namespace OpenSim.Grid.MessagingServer | |||
333 | /// <returns></returns> | 333 | /// <returns></returns> |
334 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) | 334 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) |
335 | { | 335 | { |
336 | 336 | m_log.Info("[LOGON]: User logged on, building indexes for user"); | |
337 | Hashtable requestData = (Hashtable)request.Params[0]; | 337 | Hashtable requestData = (Hashtable)request.Params[0]; |
338 | AgentCircuitData agentData = new AgentCircuitData(); | 338 | AgentCircuitData agentData = new AgentCircuitData(); |
339 | agentData.SessionID = new LLUUID((string)requestData["session_id"]); | 339 | agentData.SessionID = new LLUUID((string)requestData["session_id"]); |
@@ -472,6 +472,108 @@ namespace OpenSim.Grid.MessagingServer | |||
472 | 472 | ||
473 | return regionProfile; | 473 | return regionProfile; |
474 | } | 474 | } |
475 | public bool registerWithUserServer () | ||
476 | { | ||
477 | |||
478 | Hashtable UserParams = new Hashtable(); | ||
479 | // Login / Authentication | ||
480 | |||
481 | if (m_cfg.HttpSSL) | ||
482 | { | ||
483 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | ||
488 | } | ||
489 | |||
490 | UserParams["recvkey"] = m_cfg.UserRecvKey; | ||
491 | UserParams["sendkey"] = m_cfg.UserRecvKey; | ||
492 | |||
493 | |||
494 | |||
495 | |||
496 | // Package into an XMLRPC Request | ||
497 | ArrayList SendParams = new ArrayList(); | ||
498 | SendParams.Add(UserParams); | ||
499 | |||
500 | // Send Request | ||
501 | XmlRpcRequest UserReq; | ||
502 | XmlRpcResponse UserResp; | ||
503 | try | ||
504 | { | ||
505 | UserReq = new XmlRpcRequest("register_messageserver", SendParams); | ||
506 | UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); | ||
507 | } catch (Exception ex) | ||
508 | { | ||
509 | m_log.Error("Unable to connect to grid. Grid server not running?"); | ||
510 | throw(ex); | ||
511 | } | ||
512 | Hashtable GridRespData = (Hashtable)UserResp.Value; | ||
513 | Hashtable griddatahash = GridRespData; | ||
514 | |||
515 | // Process Response | ||
516 | if (GridRespData.ContainsKey("responsestring")) | ||
517 | { | ||
518 | return true; | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | return false; | ||
523 | } | ||
524 | |||
525 | |||
526 | } | ||
527 | public bool deregisterWithUserServer() | ||
528 | { | ||
529 | |||
530 | Hashtable UserParams = new Hashtable(); | ||
531 | // Login / Authentication | ||
532 | |||
533 | if (m_cfg.HttpSSL) | ||
534 | { | ||
535 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | ||
536 | } | ||
537 | else | ||
538 | { | ||
539 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | ||
540 | } | ||
541 | |||
542 | UserParams["recvkey"] = m_cfg.UserRecvKey; | ||
543 | UserParams["sendkey"] = m_cfg.UserRecvKey; | ||
544 | |||
545 | // Package into an XMLRPC Request | ||
546 | ArrayList SendParams = new ArrayList(); | ||
547 | SendParams.Add(UserParams); | ||
548 | |||
549 | // Send Request | ||
550 | XmlRpcRequest UserReq; | ||
551 | XmlRpcResponse UserResp; | ||
552 | try | ||
553 | { | ||
554 | UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); | ||
555 | UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); | ||
556 | } | ||
557 | catch (Exception ex) | ||
558 | { | ||
559 | m_log.Error("Unable to connect to grid. Grid server not running?"); | ||
560 | throw (ex); | ||
561 | } | ||
562 | Hashtable UserRespData = (Hashtable)UserResp.Value; | ||
563 | Hashtable userdatahash = UserRespData; | ||
564 | |||
565 | // Process Response | ||
566 | if (UserRespData.ContainsKey("responsestring")) | ||
567 | { | ||
568 | return true; | ||
569 | } | ||
570 | else | ||
571 | { | ||
572 | return false; | ||
573 | } | ||
574 | |||
575 | |||
576 | } | ||
475 | #endregion | 577 | #endregion |
476 | } | 578 | } |
477 | 579 | ||