diff options
author | Adam Frisby | 2009-12-27 16:07:05 +1100 |
---|---|---|
committer | Adam Frisby | 2009-12-27 16:07:05 +1100 |
commit | 8a931a4e914a00cbf0e853b83e74e56ace08419e (patch) | |
tree | cae24ef94682d8ba05ea4dfe44b88b2e228b45e0 /OpenSim/Client/Sirikata/SirikataModule.cs | |
parent | * Added prebuild for previous commit. (diff) | |
download | opensim-SC_OLD-8a931a4e914a00cbf0e853b83e74e56ace08419e.zip opensim-SC_OLD-8a931a4e914a00cbf0e853b83e74e56ace08419e.tar.gz opensim-SC_OLD-8a931a4e914a00cbf0e853b83e74e56ace08419e.tar.bz2 opensim-SC_OLD-8a931a4e914a00cbf0e853b83e74e56ace08419e.tar.xz |
* Implements some basic Sirikata protocol work (initial handshakes).
Diffstat (limited to 'OpenSim/Client/Sirikata/SirikataModule.cs')
-rw-r--r-- | OpenSim/Client/Sirikata/SirikataModule.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Client/Sirikata/SirikataModule.cs b/OpenSim/Client/Sirikata/SirikataModule.cs index d2d7ff8..cbb6c23 100644 --- a/OpenSim/Client/Sirikata/SirikataModule.cs +++ b/OpenSim/Client/Sirikata/SirikataModule.cs | |||
@@ -60,8 +60,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
60 | 60 | ||
61 | using System; | 61 | using System; |
62 | using System.Collections.Generic; | 62 | using System.Collections.Generic; |
63 | using System.Net; | ||
64 | using System.Net.Sockets; | ||
63 | using Nini.Config; | 65 | using Nini.Config; |
64 | using OpenMetaverse; | 66 | using OpenMetaverse; |
67 | using OpenSim.Client.Sirikata.ClientStack; | ||
65 | using OpenSim.Framework; | 68 | using OpenSim.Framework; |
66 | using OpenSim.Framework.Servers; | 69 | using OpenSim.Framework.Servers; |
67 | using OpenSim.Framework.Servers.HttpServer; | 70 | using OpenSim.Framework.Servers.HttpServer; |
@@ -72,18 +75,50 @@ namespace OpenSim.Client.Sirikata | |||
72 | { | 75 | { |
73 | class SirikataModule : IRegionModule | 76 | class SirikataModule : IRegionModule |
74 | { | 77 | { |
78 | private bool m_enabled = false; | ||
79 | |||
80 | private TcpListener m_listener; | ||
81 | private bool m_running = true; | ||
82 | |||
83 | private List<Scene> m_scenes = new List<Scene>(); | ||
84 | private Dictionary<UUID,SirikataClientView> m_clients = new Dictionary<UUID, SirikataClientView>(); | ||
85 | |||
75 | #region Implementation of IRegionModule | 86 | #region Implementation of IRegionModule |
76 | 87 | ||
77 | public void Initialise(Scene scene, IConfigSource source) | 88 | public void Initialise(Scene scene, IConfigSource source) |
78 | { | 89 | { |
79 | 90 | lock (m_scenes) | |
91 | m_scenes.Add(scene); | ||
80 | } | 92 | } |
81 | 93 | ||
82 | public void PostInitialise() | 94 | public void PostInitialise() |
83 | { | 95 | { |
96 | if(!m_enabled) | ||
97 | return; | ||
98 | |||
99 | m_listener = new TcpListener(IPAddress.Any, 5943); | ||
84 | 100 | ||
85 | } | 101 | } |
86 | 102 | ||
103 | private void ListenLoop() | ||
104 | { | ||
105 | while(m_running) | ||
106 | { | ||
107 | m_listener.BeginAcceptTcpClient(AcceptSocket, m_listener); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | private void AcceptSocket(IAsyncResult ar) | ||
112 | { | ||
113 | TcpListener listener = (TcpListener) ar.AsyncState; | ||
114 | TcpClient client = listener.EndAcceptTcpClient(ar); | ||
115 | |||
116 | SirikataClientView clientView = new SirikataClientView(client); | ||
117 | |||
118 | lock (m_clients) | ||
119 | m_clients.Add(clientView.SessionId, clientView); | ||
120 | } | ||
121 | |||
87 | public void Close() | 122 | public void Close() |
88 | { | 123 | { |
89 | 124 | ||