aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Servers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.Servers/LocalUserProfileManager.cs1
-rw-r--r--OpenSim.Servers/LoginServer.cs1
-rw-r--r--OpenSim.Servers/OpenGridProtocol.cs183
3 files changed, 96 insertions, 89 deletions
diff --git a/OpenSim.Servers/LocalUserProfileManager.cs b/OpenSim.Servers/LocalUserProfileManager.cs
index 6166e02..989af22 100644
--- a/OpenSim.Servers/LocalUserProfileManager.cs
+++ b/OpenSim.Servers/LocalUserProfileManager.cs
@@ -33,6 +33,7 @@ using OpenSim.Framework.User;
33using OpenSim.Framework.Grid; 33using OpenSim.Framework.Grid;
34using OpenSim.Framework.Inventory; 34using OpenSim.Framework.Inventory;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework.Types;
36using libsecondlife; 37using libsecondlife;
37 38
38namespace OpenSim.UserServer 39namespace OpenSim.UserServer
diff --git a/OpenSim.Servers/LoginServer.cs b/OpenSim.Servers/LoginServer.cs
index 77f0dd8..c56dbc1 100644
--- a/OpenSim.Servers/LoginServer.cs
+++ b/OpenSim.Servers/LoginServer.cs
@@ -43,6 +43,7 @@ using OpenSim.Framework.Grid;
43using OpenSim.Framework.Inventory; 43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.User; 44using OpenSim.Framework.User;
45using OpenSim.Framework.Utilities; 45using OpenSim.Framework.Utilities;
46using OpenSim.Framework.Types;
46 47
47namespace OpenSim.UserServer 48namespace OpenSim.UserServer
48{ 49{
diff --git a/OpenSim.Servers/OpenGridProtocol.cs b/OpenSim.Servers/OpenGridProtocol.cs
index c3d7d5c..55c47b4 100644
--- a/OpenSim.Servers/OpenGridProtocol.cs
+++ b/OpenSim.Servers/OpenGridProtocol.cs
@@ -1,89 +1,94 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Net; 3using System.Net;
4using System.Net.Sockets; 4using System.Net.Sockets;
5using System.Text; 5using System.Text;
6using System.Text.RegularExpressions; 6using System.Text.RegularExpressions;
7using System.Threading; 7using System.Threading;
8using Nwc.XmlRpc; 8using Nwc.XmlRpc;
9using System.Collections; 9using System.Collections;
10 10
11namespace OpenSim.Servers 11namespace OpenSim.Servers
12{ 12{
13 public class OpenGridProtocolServer 13 public class OpenGridProtocolServer
14 { 14 {
15 15
16 private Thread m_workerThread; 16 private Thread m_workerThread;
17 private Socket m_listenerSocket; 17 private Socket m_listenerSocket;
18 private IPEndPoint m_IPendpoint; 18 private IPEndPoint m_IPendpoint;
19 19
20 private int m_port; 20 private int m_port;
21 private ArrayList m_clients; 21 private ArrayList m_clients;
22 22
23 private class ClientHandler { 23 private class ClientHandler
24 private Thread m_clientThread; 24 {
25 private Socket m_socketHandle; 25 private Thread m_clientThread;
26 26 private Socket m_socketHandle;
27 public ClientHandler(Socket clientSocketHandle) { 27
28 m_socketHandle=clientSocketHandle; 28 public ClientHandler(Socket clientSocketHandle)
29 m_clientThread = new Thread(new ThreadStart(DoWork)); 29 {
30 m_clientThread.IsBackground = true; 30 m_socketHandle = clientSocketHandle;
31 m_clientThread.Start(); 31 m_clientThread = new Thread(new ThreadStart(DoWork));
32 } 32 m_clientThread.IsBackground = true;
33 33 m_clientThread.Start();
34 private void DoWork() { 34 }
35 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client"); 35
36 this.WriteLine("OpenSim 0.1, running OGS protocol 1.0"); 36 private void DoWork()
37 37 {
38 } 38 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
39 39 this.WriteLine("OpenSim 0.1, running OGS protocol 1.0");
40 private void WriteLine(string theline) { 40
41 theline+="\n"; 41 }
42 byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray()); 42
43 m_socketHandle.Send(thelinebuffer,theline.Length,0); 43 private void WriteLine(string theline)
44 } 44 {
45 } 45 theline += "\n";
46 46 byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray());
47 public OpenGridProtocolServer(int port) 47 m_socketHandle.Send(thelinebuffer, theline.Length, 0);
48 { 48 }
49 m_port = port; 49 }
50 } 50
51 51 public OpenGridProtocolServer(int port)
52 public void Start() 52 {
53 { 53 m_port = port;
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: Start() - Opening server socket"); 54 }
55 55
56 m_clients = new ArrayList(); 56 public void Start()
57 m_workerThread = new Thread(new ThreadStart(StartServerSocket)); 57 {
58 m_workerThread.IsBackground = true; 58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: Start() - Opening server socket");
59 m_workerThread.Start(); 59
60 } 60 m_clients = new ArrayList();
61 61 m_workerThread = new Thread(new ThreadStart(StartServerSocket));
62 private void StartServerSocket() 62 m_workerThread.IsBackground = true;
63 { 63 m_workerThread.Start();
64 try 64 }
65 { 65
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK"); 66 private void StartServerSocket()
67 67 {
68 68 try
69 m_IPendpoint = new IPEndPoint(IPAddress.Any, m_port); 69 {
70 m_listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); 70 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK");
71 m_listenerSocket.Bind(m_IPendpoint); 71
72 m_listenerSocket.Listen(4); 72
73 73 m_IPendpoint = new IPEndPoint(IPAddress.Any, m_port);
74 Socket sockethandle; 74 m_listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
75 while (true) 75 m_listenerSocket.Bind(m_IPendpoint);
76 { 76 m_listenerSocket.Listen(4);
77 sockethandle = m_listenerSocket.Accept(); 77
78 lock(m_clients.SyncRoot) { 78 Socket sockethandle;
79 m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle)); 79 while (true)
80 } 80 {
81 } 81 sockethandle = m_listenerSocket.Accept();
82 } 82 lock (m_clients.SyncRoot)
83 catch (Exception e) 83 {
84 { 84 m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message); 85 }
86 } 86 }
87 } 87 }
88 } 88 catch (Exception e)
89} 89 {
90 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message);
91 }
92 }
93 }
94}