Jump to content

OpenSimulator Internals/Code Map/ROBUST: Difference between revisions

From Open Simulator Technical Help
Jwbshaw (talk | contribs)
first
 
Jwbshaw (talk | contribs)
updates
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
=== Entry Point ===
=== Entry Point ===


  OpenSim/Server/Base/OpenSimServer.cs -- Main()
  OpenSim/Server/ServerMain.cs -- class OpenSimServer, Main()


Sequence:
Sequence:


# Instantiates HttpServerBase ("R.O.B.U.S.T.", args)
# Sets culture and .NET HTTP client defaults:
# Config loaded in layers (see below)
#* ServicePointManager.DefaultConnectionLimit = 64
# HTTP server(s) started
#* ServicePointManager.MaxServicePointIdleTime = 30000
# Service connector plugins loaded from [ServiceList] in Robust.ini
#* Expect100Continue = false
# Main loop -- console prompt, watchdog, waits for shutdown
#* UseNagleAlgorithm = false
#* ServerCertificateValidationCallback = ValidateServerCertificate
# Creates HttpServerBase("R.O.B.U.S.T.", args) -- config is loaded here (see Config Loading below)
# Reads [Startup] section -- throws if missing
# Reads DnsTimeout (default 30000ms), NoVerifyCertChain, NoVerifyCertHostname from [Startup]
# Calls WebUtil.SetupHTTPClients() with cert settings and max 32 connections
# Reads connector list -- merges ServiceConnectors from [Startup] with all keys from [ServiceList]
# Copies System.Drawing.Common.dll for current platform (Windows vs Linux)
# Loops through connectors -- parses configName@port/dll:class format, loads each (see Service Connector Loading below)
# Special case: LLLoginServiceInConnector gets an IndexPHPHandler added to its HTTP server before loading
# Prints robuststartuplogo.txt to console if present
# Creates PluginLoader
# Calls m_Server.Run() -- enters main loop
# On exit: m_Server.Shutdown(), Util.StopThreadPool(), Environment.Exit()


----
----
Line 23: Line 36:
=== Config Loading ===
=== Config Loading ===


  OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
  OpenSim/Server/Base/HttpServerBase.cs
  OpenSim/Server/Base/ServicesServerBase.cs
  OpenSim/Server/Base/ServicesServerBase.cs


Config is loaded in layers, each overriding the previous:
HttpServerBase constructor handles config loading. Layers are applied in order, each overriding the previous:


# Command line args parsed (-i ini file, -c console, -l logfile, -p prompt, -g logconfig)
# Command line args parsed (-i ini file, -c console, -l logfile, -p prompt, -g logconfig)
Line 46: Line 59:
=== HTTP Servers ===
=== HTTP Servers ===


  OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
  OpenSim/Server/Base/HttpServerBase.cs


* Main HTTP server created on port from [Network]
* Main HTTP server created on port from [Network]
* Optional second SSL listener if https_listener = true
* Optional second SSL listener if https_listener = true
* All servers started before connectors are loaded -- handlers register into a running server
* All servers started before connectors are loaded
* Additional ports are created on demand via MainServer.GetHttpServer(port) during connector loading
* Handlers register into a running server during connector construction


----
----
Line 56: Line 71:
=== Service Connector Loading ===
=== Service Connector Loading ===


OpenSim/Server/Base/ServicesServerBase.cs -- LoadPlugins()
  OpenSim/Server/Base/ServerUtils.cs -- LoadPlugin()
  OpenSim/Server/Base/ServerUtils.cs -- LoadPlugin()


Each entry in [ServiceList] in Robust.ini is loaded as a plugin:
Connector string format:


  AssetServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:AssetServiceConnector"
  configName@port/OpenSim.Server.Handlers.dll:ClassName


Format: Port/DllName:ClassName
Parsing:
* Split on / -- left side is optional configName@port, right side is dll:class
* Split left side on @ -- if two parts, first is configName, second is port
* If port specified: get or create HTTP server for that port via MainServer.GetHttpServer()
* If no port: use MainServer.Instance (main port)


LoadPlugin() uses .NET reflection to instantiate each connector class, passing IConfigSource and IHttpServer. Each connector registers its HTTP handlers on the running server during construction.
Loading:
* LoadPlugin() tries constructor with (IConfigSource, IHttpServer, configName) first
* Falls back to (IConfigSource, IHttpServer) if that fails
* Loaded connectors added to m_ServiceConnectors list
* Failed loads logged as errors but do not stop startup


See [[OpenSimulator Internals/Connector Architecture]] for the full connector pattern.
See [[OpenSimulator Internals/Connector Architecture]] for the full connector pattern.
Line 78: Line 100:
* Sits in a console prompt loop
* Sits in a console prompt loop
* Shutdown signal (quit/shutdown command or SIGTERM) triggers:
* Shutdown signal (quit/shutdown command or SIGTERM) triggers:
** HTTP server shutdown
** m_Server.Shutdown()
** Watchdog disposal
** Util.StopThreadPool()
** Thread pool shutdown
** Environment.Exit()
** PID file removal


----
----
Line 87: Line 108:
=== Service Implementations ===
=== Service Implementations ===


Each service connector loaded from [ServiceList] handles one service domain. See [[OpenSimulator Internals/ROBUST Services]] for the full list.
Each service connector loaded from [ServiceList] handles one service domain.


{| class="wikitable"
{| class="wikitable"
Line 103: Line 124:
|-
|-
| AuthenticationService || OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs || OpenSim/Server/Handlers/Authentication/
| AuthenticationService || OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs || OpenSim/Server/Handlers/Authentication/
|-
| AvatarService || OpenSim/Services/AvatarService/AvatarService.cs || OpenSim/Server/Handlers/Avatar/
|-
| GridUserService || OpenSim/Services/UserAccountService/GridUserService.cs || OpenSim/Server/Handlers/GridUser/
|-
| AgentPreferencesService || OpenSim/Services/UserAccountService/AgentPreferencesService.cs || OpenSim/Server/Handlers/AgentPreferences/
|-
|-
| LoginService || OpenSim/Services/LLLoginService/LLLoginService.cs || OpenSim/Server/Handlers/Login/
| LoginService || OpenSim/Services/LLLoginService/LLLoginService.cs || OpenSim/Server/Handlers/Login/
Line 110: Line 137:
| UserAgentService || OpenSim/Services/HypergridService/UserAgentService.cs || OpenSim/Server/Handlers/Hypergrid/
| UserAgentService || OpenSim/Services/HypergridService/UserAgentService.cs || OpenSim/Server/Handlers/Hypergrid/
|}
|}
Note: GridUserService and AgentPreferencesService source files live in the UserAccountService directory, not separate directories.
See [[OpenSimulator Internals/Code Map/ROBUST/GridService RegisterRegion]] for a detailed trace of GridService.RegisterRegion() and DeregisterRegion().
See [[OpenSimulator Internals/Code Map/ROBUST/PresenceService]] for a detailed trace of PresenceService.
See [[OpenSimulator Internals/Code Map/ROBUST/UserAccountService]] for a detailed trace of UserAccountService.
See [[OpenSimulator Internals/Code Map/ROBUST/InventoryService]] for a detailed trace of InventoryService.
See [[OpenSimulator Internals/Code Map/ROBUST/AuthenticationService]] for a detailed trace of AuthenticationService, including the impersonation mechanism.
See [[OpenSimulator Internals/Code Map/ROBUST/AvatarService]] for a detailed trace of AvatarService.
See [[OpenSimulator Internals/Code Map/ROBUST/GridUserService]] for a detailed trace of GridUserService.
See [[OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService]] for a detailed trace of AgentPreferencesService.
See [[OpenSimulator Internals/Code Map/ROBUST/LoginService]] for a detailed trace of LLLoginService.
See [[OpenSimulator Internals/Code Map/ROBUST/GatekeeperService]] for a detailed trace of GatekeeperService.
See [[OpenSimulator Internals/Code Map/ROBUST/UserAgentService]] for a detailed trace of UserAgentService.


----
----
Line 116: Line 167:


* [[OpenSimulator Internals/Code Map]]
* [[OpenSimulator Internals/Code Map]]
* [[OpenSimulator Internals/Code Map/Scene]]
* [[OpenSimulator Internals/Code Map/ScenePresence]]
* [[OpenSimulator Internals/Code Map/AvatarFactoryModule]]
* [[OpenSimulator Internals/Code Map/AttachmentsModule]]
* [[OpenSimulator Internals/Code Map/EntityTransferModule]]
* [[OpenSimulator Internals/Code Map/HGEntityTransferModule]]
* [[OpenSimulator Internals/Code Map/InventoryAccessModule]]
* [[OpenSimulator Internals/Reading the Code]]
* [[OpenSimulator Internals/Reading the Code]]
* [[OpenSimulator Internals/ROBUST Services]]
* [[OpenSimulator Internals/ROBUST Services]]
* [[OpenSimulator Internals/Connector Architecture]]
* [[OpenSimulator Internals/Connector Architecture]]

Latest revision as of 13:57, 7 July 2026

OpenSimulator Internals/Code Map/ROBUST

[edit]

Overview

[edit]

ROBUST is the grid services process. It reads configuration, starts HTTP listeners, loads service connector plugins, then sits waiting for incoming HTTP requests from simulators.


Entry Point

[edit]
OpenSim/Server/ServerMain.cs -- class OpenSimServer, Main()

Sequence:

  1. Sets culture and .NET HTTP client defaults:
    • ServicePointManager.DefaultConnectionLimit = 64
    • ServicePointManager.MaxServicePointIdleTime = 30000
    • Expect100Continue = false
    • UseNagleAlgorithm = false
    • ServerCertificateValidationCallback = ValidateServerCertificate
  2. Creates HttpServerBase("R.O.B.U.S.T.", args) -- config is loaded here (see Config Loading below)
  3. Reads [Startup] section -- throws if missing
  4. Reads DnsTimeout (default 30000ms), NoVerifyCertChain, NoVerifyCertHostname from [Startup]
  5. Calls WebUtil.SetupHTTPClients() with cert settings and max 32 connections
  6. Reads connector list -- merges ServiceConnectors from [Startup] with all keys from [ServiceList]
  7. Copies System.Drawing.Common.dll for current platform (Windows vs Linux)
  8. Loops through connectors -- parses configName@port/dll:class format, loads each (see Service Connector Loading below)
  9. Special case: LLLoginServiceInConnector gets an IndexPHPHandler added to its HTTP server before loading
  10. Prints robuststartuplogo.txt to console if present
  11. Creates PluginLoader
  12. Calls m_Server.Run() -- enters main loop
  13. On exit: m_Server.Shutdown(), Util.StopThreadPool(), Environment.Exit()

Config Loading

[edit]
OpenSim/Server/Base/HttpServerBase.cs
OpenSim/Server/Base/ServicesServerBase.cs

HttpServerBase constructor handles config loading. Layers are applied in order, each overriding the previous:

  1. Command line args parsed (-i ini file, -c console, -l logfile, -p prompt, -g logconfig)
  2. Ini file loaded -- defaults to Robust.ini, derived from executable name. Can be a local file or remote HTTP/HTTPS URL.
  3. Include-* keys scanned -- additional ini files merged in. Supports wildcards and URLs. Loop repeats until no new includes found.
  4. Environment variables merged in
  5. Command line args merged on top -- command line always wins
  6. Variable substitution run (ReplaceKeyValues) -- expands ${Section|Key} references
  7. ReadConfig() called -- reads [Network] section for port and SSL settings

[Network] minimum requirements:

  • port -- required, no default, ROBUST will not start without it
  • https_main, https_listener, https_external -- optional SSL flags
  • cert_path, cert_pass -- required if SSL enabled
  • ConsolePort -- optional remote console port

HTTP Servers

[edit]
OpenSim/Server/Base/HttpServerBase.cs
  • Main HTTP server created on port from [Network]
  • Optional second SSL listener if https_listener = true
  • All servers started before connectors are loaded
  • Additional ports are created on demand via MainServer.GetHttpServer(port) during connector loading
  • Handlers register into a running server during connector construction

Service Connector Loading

[edit]
OpenSim/Server/Base/ServerUtils.cs -- LoadPlugin()

Connector string format:

configName@port/OpenSim.Server.Handlers.dll:ClassName

Parsing:

  • Split on / -- left side is optional configName@port, right side is dll:class
  • Split left side on @ -- if two parts, first is configName, second is port
  • If port specified: get or create HTTP server for that port via MainServer.GetHttpServer()
  • If no port: use MainServer.Instance (main port)

Loading:

  • LoadPlugin() tries constructor with (IConfigSource, IHttpServer, configName) first
  • Falls back to (IConfigSource, IHttpServer) if that fails
  • Loaded connectors added to m_ServiceConnectors list
  • Failed loads logged as errors but do not stop startup

See OpenSimulator Internals/Connector Architecture for the full connector pattern.


Main Loop

[edit]
OpenSim/Server/Base/ServicesServerBase.cs -- Run()
  • Watchdog and MemoryWatchdog threads enabled
  • Sits in a console prompt loop
  • Shutdown signal (quit/shutdown command or SIGTERM) triggers:
    • m_Server.Shutdown()
    • Util.StopThreadPool()
    • Environment.Exit()

Service Implementations

[edit]

Each service connector loaded from [ServiceList] handles one service domain.

Service Implementation Handler
AssetService OpenSim/Services/AssetService/AssetService.cs OpenSim/Server/Handlers/Asset/
GridService OpenSim/Services/GridService/GridService.cs OpenSim/Server/Handlers/Grid/
UserAccountService OpenSim/Services/UserAccountService/UserAccountService.cs OpenSim/Server/Handlers/UserAccounts/
PresenceService OpenSim/Services/PresenceService/PresenceService.cs OpenSim/Server/Handlers/Presence/
InventoryService OpenSim/Services/InventoryService/XInventoryService.cs OpenSim/Server/Handlers/Inventory/
AuthenticationService OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs OpenSim/Server/Handlers/Authentication/
AvatarService OpenSim/Services/AvatarService/AvatarService.cs OpenSim/Server/Handlers/Avatar/
GridUserService OpenSim/Services/UserAccountService/GridUserService.cs OpenSim/Server/Handlers/GridUser/
AgentPreferencesService OpenSim/Services/UserAccountService/AgentPreferencesService.cs OpenSim/Server/Handlers/AgentPreferences/
LoginService OpenSim/Services/LLLoginService/LLLoginService.cs OpenSim/Server/Handlers/Login/
GatekeeperService OpenSim/Services/HypergridService/GatekeeperService.cs OpenSim/Server/Handlers/Hypergrid/
UserAgentService OpenSim/Services/HypergridService/UserAgentService.cs OpenSim/Server/Handlers/Hypergrid/

Note: GridUserService and AgentPreferencesService source files live in the UserAccountService directory, not separate directories.

See OpenSimulator Internals/Code Map/ROBUST/GridService RegisterRegion for a detailed trace of GridService.RegisterRegion() and DeregisterRegion().

See OpenSimulator Internals/Code Map/ROBUST/PresenceService for a detailed trace of PresenceService.

See OpenSimulator Internals/Code Map/ROBUST/UserAccountService for a detailed trace of UserAccountService.

See OpenSimulator Internals/Code Map/ROBUST/InventoryService for a detailed trace of InventoryService.

See OpenSimulator Internals/Code Map/ROBUST/AuthenticationService for a detailed trace of AuthenticationService, including the impersonation mechanism.

See OpenSimulator Internals/Code Map/ROBUST/AvatarService for a detailed trace of AvatarService.

See OpenSimulator Internals/Code Map/ROBUST/GridUserService for a detailed trace of GridUserService.

See OpenSimulator Internals/Code Map/ROBUST/AgentPreferencesService for a detailed trace of AgentPreferencesService.

See OpenSimulator Internals/Code Map/ROBUST/LoginService for a detailed trace of LLLoginService.

See OpenSimulator Internals/Code Map/ROBUST/GatekeeperService for a detailed trace of GatekeeperService.

See OpenSimulator Internals/Code Map/ROBUST/UserAgentService for a detailed trace of UserAgentService.


See Also

[edit]