Jump to content

OpenSimulator Internals/Code Map: Difference between revisions

From Open Simulator Technical Help
Jwbshaw (talk | contribs)
add
Jwbshaw (talk | contribs)
wrong paste
Line 1: Line 1:
= OpenSimulator Internals/Code Map/ROBUST =
= OpenSimulator Internals/Code Map =


== Overview ==
== Overview ==


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.
This page maps the OpenSimulator codebase from the top down. Each section links to a drill-down page covering that component in detail.


----
Both ROBUST and OpenSim.exe are built from the same source tree and share the same DLL output. The difference is which entry point is called and which config file is loaded.


=== Entry Point ===
Source repository: https://github.com/opensim/opensim
 
OpenSim/Server/ServerMain.cs -- class OpenSimServer, Main()
 
Sequence:
 
# Sets culture and .NET HTTP client defaults:
#* ServicePointManager.DefaultConnectionLimit = 64
#* ServicePointManager.MaxServicePointIdleTime = 30000
#* Expect100Continue = false
#* 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()


----
----


=== Config Loading ===
* [[OpenSimulator Internals/Code Map/ROBUST]] -- Grid services process
 
* [[OpenSimulator Internals/Code Map/OpenSim]] -- Region simulator process
OpenSim/Server/Base/HttpServerBase.cs
** [[OpenSimulator Internals/Code Map/LLUDP]] -- Viewer network transport layer
OpenSim/Server/Base/ServicesServerBase.cs
** [[OpenSimulator Internals/Code Map/LLClientView]] -- IClientAPI implementation, packet dispatch and entity update encoding
 
* [[OpenSimulator Internals/Code Map/Shared]] -- Code used by both
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)
# Ini file loaded -- defaults to Robust.ini, derived from executable name. Can be a local file or remote HTTP/HTTPS URL.
# Include-* keys scanned -- additional ini files merged in. Supports wildcards and URLs. Loop repeats until no new includes found.
# Environment variables merged in
# Command line args merged on top -- command line always wins
# Variable substitution run (ReplaceKeyValues) -- expands ${Section|Key} references
# 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 ===
 
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 ===
 
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 ===
 
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 ===
 
Each service connector loaded from [ServiceList] handles one service domain. See [[OpenSimulator Internals/ROBUST Services]] for the full list.
 
{| class="wikitable"
! 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/
|-
| 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/
|}
 
See [[OpenSimulator Internals/Code Map/ROBUST/GridService RegisterRegion]] for a detailed trace of GridService.RegisterRegion() and DeregisterRegion().


----
----
Line 138: Line 21:
== See Also ==
== See Also ==


* [[OpenSimulator Internals/Code Map]]
* [[OpenSimulator Internals/Reading the Code]]
* [[OpenSimulator Internals/Reading the Code]]
* [[OpenSimulator Internals/ROBUST Services]]
* [[OpenSimulator Internals/Architecture Overview]]
* [[OpenSimulator Internals/Connector Architecture]]
* [[OpenSimulator Internals/Connector Architecture]]

Revision as of 11:52, 7 July 2026

OpenSimulator Internals/Code Map

Overview

This page maps the OpenSimulator codebase from the top down. Each section links to a drill-down page covering that component in detail.

Both ROBUST and OpenSim.exe are built from the same source tree and share the same DLL output. The difference is which entry point is called and which config file is loaded.

Source repository: https://github.com/opensim/opensim



See Also