aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Server.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Server.cs')
-rw-r--r--Server.cs27
1 files changed, 14 insertions, 13 deletions
diff --git a/Server.cs b/Server.cs
index 7bc4050..342592a 100644
--- a/Server.cs
+++ b/Server.cs
@@ -37,16 +37,17 @@ using System.Timers;
37 37
38//really hacked , messy code 38//really hacked , messy code
39 39
40namespace Second_server 40namespace OpenSim
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Description of Server. 43 /// Description of Server.
44 /// </summary> 44 /// </summary>
45 public interface Server_callback 45 public interface ServerCallback
46 { 46 {
47 void main_callback(Packet pack, User_Agent_info User_info); 47 //should replace with delegates
48 void new_user(User_Agent_info User_info); 48 void MainCallback(Packet pack, User_Agent_info User_info);
49 void error(string text); 49 void NewUserCallback(User_Agent_info User_info);
50 void ErrorCallback(string text);
50 } 51 }
51 public class Server 52 public class Server
52 { 53 {
@@ -91,7 +92,7 @@ namespace Second_server
91 get { return connected; } 92 get { return connected; }
92 } 93 }
93 94
94 private Server_callback callback_object; 95 private ServerCallback CallbackObject;
95 //private NetworkManager Network; 96 //private NetworkManager Network;
96 // private Dictionary<PacketType, List<NetworkManager.PacketCallback>> Callbacks; 97 // private Dictionary<PacketType, List<NetworkManager.PacketCallback>> Callbacks;
97 private uint Sequence = 0; 98 private uint Sequence = 0;
@@ -125,10 +126,10 @@ namespace Second_server
125 /// <param name="circuit"></param> 126 /// <param name="circuit"></param>
126 /// <param name="ip"></param> 127 /// <param name="ip"></param>
127 /// <param name="port"></param> 128 /// <param name="port"></param>
128 public Server(Server_callback s_callback) 129 public Server(ServerCallback s_callback)
129 { 130 {
130 131
131 this.callback_object=s_callback; 132 this.CallbackObject=s_callback;
132 // Client = client; 133 // Client = client;
133 // Network = client.Network; 134 // Network = client.Network;
134 // Callbacks = callbacks; 135 // Callbacks = callbacks;
@@ -148,7 +149,7 @@ namespace Second_server
148 // Create an endpoint that we will be communicating with (need it in two 149 // Create an endpoint that we will be communicating with (need it in two
149 // types due to .NET weirdness) 150 // types due to .NET weirdness)
150 // ipEndPoint = new IPEndPoint(ip, port); 151 // ipEndPoint = new IPEndPoint(ip, port);
151 ipEndPoint = new IPEndPoint(IPAddress.Any, 1000); 152 ipEndPoint = new IPEndPoint(IPAddress.Any, Globals.Instance.IpPort);
152 153
153 154
154 endPoint = (EndPoint)ipEndPoint; 155 endPoint = (EndPoint)ipEndPoint;
@@ -486,7 +487,7 @@ namespace Second_server
486 new_user.endpoint=epSender; 487 new_user.endpoint=epSender;
487 new_user.Inbox = new Queue<uint>(Settings.INBOX_SIZE); 488 new_user.Inbox = new Queue<uint>(Settings.INBOX_SIZE);
488 489
489 this.callback_object.new_user(new_user); 490 this.CallbackObject.NewUserCallback(new_user);
490 this.User_agents.Add(new_user); 491 this.User_agents.Add(new_user);
491 492
492 } 493 }
@@ -526,14 +527,14 @@ namespace Second_server
526 { 527 {
527 528
528 //error finding agent 529 //error finding agent
529 this.callback_object.error("no user found"); 530 this.CallbackObject.ErrorCallback("no user found");
530 return; 531 return;
531 } 532 }
532 533
533 // Fail-safe check 534 // Fail-safe check
534 if (packet == null) 535 if (packet == null)
535 { 536 {
536 this.callback_object.error("couldn't build packet"); 537 this.CallbackObject.ErrorCallback("couldn't build packet");
537 // Client.Log("Couldn't build a message from the incoming data", Helpers.LogLevel.Warning); 538 // Client.Log("Couldn't build a message from the incoming data", Helpers.LogLevel.Warning);
538 return; 539 return;
539 } 540 }
@@ -615,7 +616,7 @@ namespace Second_server
615 } 616 }
616 617
617 // this.callback_object.error("calling callback"); 618 // this.callback_object.error("calling callback");
618 this.callback_object.main_callback(packet,User_info); 619 this.CallbackObject.MainCallback(packet,User_info);
619 // this.callback_object.error("finished"); 620 // this.callback_object.error("finished");
620 // Fire the registered packet events 621 // Fire the registered packet events
621 #region FireCallbacks 622 #region FireCallbacks