aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Servers/OpenGridProtocol.cs
diff options
context:
space:
mode:
authorMW2007-05-16 15:46:22 +0000
committerMW2007-05-16 15:46:22 +0000
commit3f39648605a432aae6a8c9ff9fb5ee481b06035e (patch)
tree52c5fab963a15b5a82b66a8617f2692b8d67674f /OpenSim.Servers/OpenGridProtocol.cs
parent* deleted some user files (diff)
downloadopensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.zip
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.gz
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.bz2
opensim-SC-3f39648605a432aae6a8c9ff9fb5ee481b06035e.tar.xz
More refactoring.
Changed AuthenticateSession handling, now calls a method in UDPServer. (but is likely to change again soon)
Diffstat (limited to '')
-rw-r--r--OpenSim.Servers/OpenGridProtocol.cs95
1 files changed, 0 insertions, 95 deletions
diff --git a/OpenSim.Servers/OpenGridProtocol.cs b/OpenSim.Servers/OpenGridProtocol.cs
deleted file mode 100644
index 66ca497..0000000
--- a/OpenSim.Servers/OpenGridProtocol.cs
+++ /dev/null
@@ -1,95 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Net;
4using System.Net.Sockets;
5using System.Text;
6using System.Text.RegularExpressions;
7using System.Threading;
8using Nwc.XmlRpc;
9using System.Collections;
10using OpenSim.Framework.Console;
11
12namespace OpenSim.Servers
13{
14 public class OpenGridProtocolServer
15 {
16
17 private Thread m_workerThread;
18 private Socket m_listenerSocket;
19 private IPEndPoint m_IPendpoint;
20
21 private int m_port;
22 private ArrayList m_clients;
23
24 private class ClientHandler
25 {
26 private Thread m_clientThread;
27 private Socket m_socketHandle;
28
29 public ClientHandler(Socket clientSocketHandle)
30 {
31 m_socketHandle = clientSocketHandle;
32 m_clientThread = new Thread(new ThreadStart(DoWork));
33 m_clientThread.IsBackground = true;
34 m_clientThread.Start();
35 }
36
37 private void DoWork()
38 {
39 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
40 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.NORMAL, "OpenSim 0.1, running OGS protocol 1.0");
41
42 }
43
44 private void WriteLine(string theline)
45 {
46 theline += "\n";
47 byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray());
48 m_socketHandle.Send(thelinebuffer, theline.Length, 0);
49 }
50 }
51
52 public OpenGridProtocolServer(int port)
53 {
54 m_port = port;
55 }
56
57 public void Start()
58 {
59 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: Start() - Opening server socket");
60
61 m_clients = new ArrayList();
62 m_workerThread = new Thread(new ThreadStart(StartServerSocket));
63 m_workerThread.IsBackground = true;
64 m_workerThread.Start();
65 }
66
67 private void StartServerSocket()
68 {
69 try
70 {
71 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK");
72
73
74 m_IPendpoint = new IPEndPoint(IPAddress.Any, m_port);
75 m_listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
76 m_listenerSocket.Bind(m_IPendpoint);
77 m_listenerSocket.Listen(4);
78
79 Socket sockethandle;
80 while (true)
81 {
82 sockethandle = m_listenerSocket.Accept();
83 lock (m_clients.SyncRoot)
84 {
85 m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
86 }
87 }
88 }
89 catch (Exception e)
90 {
91 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM,e.Message);
92 }
93 }
94 }
95}