More refactoring.

Changed AuthenticateSession handling, now calls a method in UDPServer. (but is likely to change again soon)
zircon^2
MW 2007-05-16 15:46:22 +00:00
parent 7f42258e62
commit 3f39648605
13 changed files with 505 additions and 796 deletions

View File

@ -150,16 +150,24 @@
</Compile>
<Compile Include="SimClient.Grid.cs">
<SubType>Code</SubType>
<DependentUpon>SimClient.cs</DependentUpon>
</Compile>
<Compile Include="SimClient.PacketHandlers.cs">
<SubType>Code</SubType>
<DependentUpon>SimClient.cs</DependentUpon>
</Compile>
<Compile Include="SimClient.ProcessPackets.cs">
<SubType>Code</SubType>
<DependentUpon>SimClient.cs</DependentUpon>
</Compile>
<Compile Include="SimClientBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UDPServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="VersionInfo.cs">
<SubType>Code</SubType>
</Compile>
@ -180,12 +188,14 @@
</Compile>
<Compile Include="world\Avatar.Client.cs">
<SubType>Code</SubType>
<DependentUpon>Avatar.cs</DependentUpon>
</Compile>
<Compile Include="world\Avatar.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Avatar.Update.cs">
<SubType>Code</SubType>
<DependentUpon>Avatar.cs</DependentUpon>
</Compile>
<Compile Include="world\AvatarAnimations.cs">
<SubType>Code</SubType>
@ -207,9 +217,11 @@
</Compile>
<Compile Include="world\World.PacketHandlers.cs">
<SubType>Code</SubType>
<DependentUpon>World.cs</DependentUpon>
</Compile>
<Compile Include="world\World.Scripting.cs">
<SubType>Code</SubType>
<DependentUpon>World.cs</DependentUpon>
</Compile>
<Compile Include="world\scripting\IScriptContext.cs">
<SubType>Code</SubType>

View File

@ -21,6 +21,7 @@
<include name="SimClient.cs" />
<include name="SimClient.Grid.cs" />
<include name="SimClient.PacketHandlers.cs" />
<include name="SimClient.ProcessPackets.cs" />
<include name="SimClientBase.cs" />
<include name="UDPServer.cs" />
<include name="VersionInfo.cs" />

View File

@ -1,186 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6E597AD4-1F7D-4389-B04C-403EF1046AAB}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll">
<HintPath>..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Axiom.MathLib.dll">
<HintPath>..\bin\Axiom.MathLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Db4objects.Db4o.dll">
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Name>OpenSim.Framework.Console</Name>
<Project>{1492353A-6133-4557-9AD8-6E24386D70F8}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Name>OpenSim.Physics.Manager</Name>
<Project>{0FD686EA-1917-469E-A885-1D9DEEA1D340}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
<Name>OpenSim.Framework</Name>
<Project>{E267CE4E-F355-4A27-8D0D-CA48FEE7F978}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Grid.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimApplication.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimMain.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenSimRoot.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="QueItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SimClient.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SimConsole.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="VersionInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Assets\AssetCache.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Assets\InventoryCache.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="CAPS\SimHttp.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="types\Mesh.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="types\Triangle.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UserServer\LocalUserProfileManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="UserServer\LoginServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Avatar.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\AvatarAnimations.cs" />
<Compile Include="world\Entity.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\Primitive.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\ScriptEngine.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\SurfacePatch.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\World.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="world\scripting\IScript.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" ?>
<project name="OpenSim" default="build">
<target name="build">
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
<copy todir="${project::get-base-directory()}/${build.dir}">
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<resources prefix="OpenSim" dynamicprefix="true" >
</resources>
<sources failonempty="true">
<include name="AgentAssetUpload.cs" />
<include name="Grid.cs" />
<include name="OpenSimApplication.cs" />
<include name="OpenSimMain.cs" />
<include name="OpenSimRoot.cs" />
<include name="QueItem.cs" />
<include name="SimClient.cs" />
<include name="SimConsole.cs" />
<include name="VersionInfo.cs" />
<include name="Assets/AssetCache.cs" />
<include name="Assets/InventoryCache.cs" />
<include name="CAPS/SimHttp.cs" />
<include name="types/Mesh.cs" />
<include name="types/Triangle.cs" />
<include name="UserServer/LocalUserProfileManager.cs" />
<include name="UserServer/LoginServer.cs" />
<include name="world/Avatar.cs" />
<include name="world/AvatarAnimations.cs" />
<include name="world/Entity.cs" />
<include name="world/Primitive.cs" />
<include name="world/ScriptEngine.cs" />
<include name="world/SurfacePatch.cs" />
<include name="world/World.cs" />
<include name="world/scripting/IScript.cs" />
</sources>
<references basedir="${project::get-base-directory()}">
<lib>
<include name="${project::get-base-directory()}" />
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="System.dll" />
<include name="System.Xml.dll.dll" />
<include name="../bin/libsecondlife.dll" />
<include name="../bin/Axiom.MathLib.dll" />
<include name="../bin/Db4objects.Db4o.dll" />
<include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
<include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
<include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
<mkdir dir="${project::get-base-directory()}/../bin/"/>
<copy todir="${project::get-base-directory()}/../bin/">
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
<include name="*.dll"/>
<include name="*.exe"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${bin.dir}" failonerror="false" />
<delete dir="${obj.dir}" failonerror="false" />
</target>
<target name="doc" description="Creates documentation.">
</target>
</project>

View File

@ -267,7 +267,7 @@ namespace OpenSim
LocalWorld.LoadWorldMap();
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system");
LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
LocalWorld.LoadPrimsFromStorage();
}

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using libsecondlife;
using OpenSim.Framework.Interfaces;
namespace OpenSim
{
@ -11,5 +13,6 @@ namespace OpenSim
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
void RemoveClientCircuit(uint circuitcode);
void RegisterPacketServer(PacketServer server);
AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
}
}

View File

@ -57,7 +57,7 @@ namespace OpenSim
m_world.RemoveViewerAgent(this);
//need to do other cleaning up here too
m_clientThreads.Remove(this.CircuitCode);
m_application.RemoveClientCircuit(this.CircuitCode);
m_networkServer.RemoveClientCircuit(this.CircuitCode);
this.ClientThread.Abort();
return true;
}

View File

@ -0,0 +1,417 @@
using System;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using Nwc.XmlRpc;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
using System.Timers;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities;
using OpenSim.world;
using OpenSim.Assets;
namespace OpenSim
{
public partial class SimClient
{
protected virtual void ProcessInPacket(Packet Pack)
{
ack_pack(Pack);
if (debug)
{
if (Pack.Type != PacketType.AgentUpdate)
{
Console.WriteLine(Pack.Type.ToString());
}
}
if (this.ProcessPacketMethod(Pack))
{
//there is a handler registered that handled this packet type
return;
}
else
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
switch (Pack.Type)
{
case PacketType.CompleteAgentMovement:
if (this.m_child) this.UpgradeClient();
ClientAvatar.CompleteMovement(m_world);
ClientAvatar.SendInitialPosition();
this.EnableNeighbours();
break;
case PacketType.RegionHandshakeReply:
m_world.SendLayerData(this);
break;
case PacketType.AgentWearablesRequest:
ClientAvatar.SendInitialAppearance();
foreach (SimClient client in m_clientThreads.Values)
{
if (client.AgentID != this.AgentID)
{
ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
this.OutPacket(objupdate);
client.ClientAvatar.SendAppearanceToOtherAgent(this);
}
}
m_world.GetInitialPrims(this);
break;
case PacketType.AgentIsNowWearing:
AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
//Console.WriteLine(Pack.ToString());
break;
case PacketType.AgentSetAppearance:
AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
// Console.WriteLine(appear.ToString());
this.ClientAvatar.SetAppearance(appear);
break;
case PacketType.ObjectAdd:
m_world.AddNewPrim((ObjectAddPacket)Pack, this);
break;
case PacketType.ObjectLink:
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
ObjectLinkPacket link = (ObjectLinkPacket)Pack;
uint parentprimid = 0;
OpenSim.world.Primitive parentprim = null;
if (link.ObjectData.Length > 1)
{
parentprimid = link.ObjectData[0].ObjectLocalID;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == parentprimid)
{
parentprim = (OpenSim.world.Primitive)ent;
}
}
for (int i = 1; i < link.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == link.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).MakeParent(parentprim);
}
}
}
}
break;
case PacketType.ObjectScale:
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
break;
case PacketType.ObjectShape:
ObjectShapePacket shape = (ObjectShapePacket)Pack;
for (int i = 0; i < shape.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == shape.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
}
}
}
break;
case PacketType.RequestImage:
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
{
m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
}
break;
case PacketType.TransferRequest:
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
m_assetCache.AddAssetRequest(this, transfer);
break;
case PacketType.AgentUpdate:
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
break;
case PacketType.ObjectImage:
ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
for (int i = 0; i < imagePack.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
}
}
}
break;
case PacketType.ObjectFlagUpdate:
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == flags.AgentData.ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
}
}
break;
case PacketType.AssetUploadRequest:
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
break;
case PacketType.RequestXfer:
//Console.WriteLine(Pack.ToString());
break;
case PacketType.SendXferPacket:
this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
break;
case PacketType.CreateInventoryFolder:
CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
//Console.WriteLine(Pack.ToString());
break;
case PacketType.CreateInventoryItem:
//Console.WriteLine(Pack.ToString());
CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
{
this.UploadAssets.CreateInventoryItem(createItem);
}
else
{
// Console.Write(Pack.ToString());
this.CreateInventoryItem(createItem);
}
break;
case PacketType.FetchInventory:
//Console.WriteLine("fetch item packet");
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
m_inventoryCache.FetchInventory(this, FetchInventory);
break;
case PacketType.FetchInventoryDescendents:
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
m_inventoryCache.FetchInventoryDescendents(this, Fetch);
break;
case PacketType.UpdateInventoryItem:
UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
//Console.WriteLine(Pack.ToString());
for (int i = 0; i < update.InventoryData.Length; i++)
{
if (update.InventoryData[i].TransactionID != LLUUID.Zero)
{
AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
if (asset != null)
{
// Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
}
else
{
asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
if (asset != null)
{
//Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
}
else
{
//Console.WriteLine("trying to update inventory item, but asset is null");
}
}
}
else
{
m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
}
}
break;
case PacketType.ViewerEffect:
ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
foreach (SimClient client in m_clientThreads.Values)
{
if (client.AgentID != this.AgentID)
{
viewer.AgentData.AgentID = client.AgentID;
viewer.AgentData.SessionID = client.SessionID;
client.OutPacket(viewer);
}
}
break;
case PacketType.RequestTaskInventory:
// Console.WriteLine(Pack.ToString());
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
bool foundent = false;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == requesttask.InventoryData.LocalID)
{
replytask.InventoryData.TaskID = ent.uuid;
replytask.InventoryData.Serial = 0;
replytask.InventoryData.Filename = new byte[0];
foundent = true;
}
}
if (foundent)
{
this.OutPacket(replytask);
}
break;
case PacketType.UpdateTaskInventory:
// Console.WriteLine(Pack.ToString());
UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
if (myinventory != null)
{
if (updatetask.UpdateData.Key == 0)
{
if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
{
if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
{
LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
if (assBase != null)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == updatetask.UpdateData.LocalID)
{
if (ent is OpenSim.world.Primitive)
{
this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
}
}
}
}
}
}
}
}
break;
case PacketType.AgentAnimation:
if (!m_child)
{
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
for (int i = 0; i < AgentAni.AnimationList.Length; i++)
{
if (AgentAni.AnimationList[i].StartAnim)
{
ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
ClientAvatar.anim_seq = 1;
ClientAvatar.SendAnimPack();
}
}
}
break;
case PacketType.ObjectSelect:
ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
for (int i = 0; i < incomingselect.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).GetProperites(this);
break;
}
}
}
break;
case PacketType.MapLayerRequest:
this.RequestMapLayer();
break;
case PacketType.MapBlockRequest:
MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
this.RequestMapBlock(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
break;
case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 8; // tp via lm
this.OutPacket(tpStart);
TeleportProgressPacket tpProgress = new TeleportProgressPacket();
tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
this.OutPacket(tpProgress);
// Fetch landmark
LLUUID lmid = tpReq.Info.LandmarkID;
AssetBase lma = this.m_assetCache.GetAsset(lmid);
if (lma != null)
{
AssetLandmark lm = new AssetLandmark(lma);
if (lm.RegionID == m_regionData.SimUUID)
{
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpReq.Info.AgentID;
tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
tpLocal.Info.LocationID = 2;
tpLocal.Info.Position = lm.Position;
OutPacket(tpLocal);
}
else
{
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel);
}
}
else
{
Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel);
}
break;
case PacketType.TeleportLocationRequest:
TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
Console.WriteLine(tpLocReq.ToString());
tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 16; // Teleport via location
Console.WriteLine(tpStart.ToString());
OutPacket(tpStart);
if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
{
/* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */
Console.WriteLine("Inter-sim teleport not yet implemented");
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
OutPacket(tpCancel);
}
else
{
Console.WriteLine("Local teleport");
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID;
tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags;
tpLocal.Info.LocationID = 2;
tpLocal.Info.LookAt = tpLocReq.Info.LookAt;
tpLocal.Info.Position = tpLocReq.Info.Position;
OutPacket(tpLocal);
}
break;
}
}
}
}
}

View File

@ -80,7 +80,7 @@ namespace OpenSim
private AssetCache m_assetCache;
private IGridServer m_gridServer;
private IUserServer m_userServer = null;
private OpenSimNetworkHandler m_application;
private OpenSimNetworkHandler m_networkServer;
private InventoryCache m_inventoryCache;
public bool m_sandboxMode;
private int cachedtextureserial = 0;
@ -104,7 +104,7 @@ namespace OpenSim
m_clientThreads = clientThreads;
m_assetCache = assetCache;
m_gridServer = gridServer;
m_application = application;
m_networkServer = application;
m_inventoryCache = inventoryCache;
m_sandboxMode = sandboxMode;
m_child = child;
@ -185,7 +185,7 @@ namespace OpenSim
m_world.RemoveViewerAgent(this);
m_clientThreads.Remove(this.CircuitCode);
m_application.RemoveClientCircuit(this.CircuitCode);
m_networkServer.RemoveClientCircuit(this.CircuitCode);
this.ClientThread.Abort();
}
@ -266,399 +266,6 @@ namespace OpenSim
}*/
}
protected virtual void ProcessInPacket(Packet Pack)
{
ack_pack(Pack);
if (debug)
{
if (Pack.Type != PacketType.AgentUpdate)
{
Console.WriteLine(Pack.Type.ToString());
}
}
if (this.ProcessPacketMethod(Pack))
{
//there is a handler registered that handled this packet type
return;
}
else
{
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
switch (Pack.Type)
{
case PacketType.CompleteAgentMovement:
if (this.m_child) this.UpgradeClient();
ClientAvatar.CompleteMovement(m_world);
ClientAvatar.SendInitialPosition();
this.EnableNeighbours();
break;
case PacketType.RegionHandshakeReply:
m_world.SendLayerData(this);
break;
case PacketType.AgentWearablesRequest:
ClientAvatar.SendInitialAppearance();
foreach (SimClient client in m_clientThreads.Values)
{
if (client.AgentID != this.AgentID)
{
ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
this.OutPacket(objupdate);
client.ClientAvatar.SendAppearanceToOtherAgent(this);
}
}
m_world.GetInitialPrims(this);
break;
case PacketType.AgentIsNowWearing:
AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
//Console.WriteLine(Pack.ToString());
break;
case PacketType.AgentSetAppearance:
AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
// Console.WriteLine(appear.ToString());
this.ClientAvatar.SetAppearance(appear);
break;
case PacketType.ObjectAdd:
m_world.AddNewPrim((ObjectAddPacket)Pack, this);
break;
case PacketType.ObjectLink:
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,Pack.ToString());
ObjectLinkPacket link = (ObjectLinkPacket)Pack;
uint parentprimid = 0;
OpenSim.world.Primitive parentprim = null;
if (link.ObjectData.Length > 1)
{
parentprimid = link.ObjectData[0].ObjectLocalID;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == parentprimid)
{
parentprim = (OpenSim.world.Primitive)ent;
}
}
for (int i = 1; i < link.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == link.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).MakeParent(parentprim);
}
}
}
}
break;
case PacketType.ObjectScale:
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,Pack.ToString());
break;
case PacketType.ObjectShape:
ObjectShapePacket shape = (ObjectShapePacket)Pack;
for (int i = 0; i < shape.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == shape.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
}
}
}
break;
case PacketType.RequestImage:
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
{
m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
}
break;
case PacketType.TransferRequest:
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
m_assetCache.AddAssetRequest(this, transfer);
break;
case PacketType.AgentUpdate:
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
break;
case PacketType.ObjectImage:
ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
for (int i = 0; i < imagePack.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
}
}
}
break;
case PacketType.ObjectFlagUpdate:
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == flags.AgentData.ObjectLocalID)
{
((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
}
}
break;
case PacketType.AssetUploadRequest:
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
break;
case PacketType.RequestXfer:
//Console.WriteLine(Pack.ToString());
break;
case PacketType.SendXferPacket:
this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
break;
case PacketType.CreateInventoryFolder:
CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
//Console.WriteLine(Pack.ToString());
break;
case PacketType.CreateInventoryItem:
//Console.WriteLine(Pack.ToString());
CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
{
this.UploadAssets.CreateInventoryItem(createItem);
}
else
{
// Console.Write(Pack.ToString());
this.CreateInventoryItem(createItem);
}
break;
case PacketType.FetchInventory:
//Console.WriteLine("fetch item packet");
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
m_inventoryCache.FetchInventory(this, FetchInventory);
break;
case PacketType.FetchInventoryDescendents:
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
m_inventoryCache.FetchInventoryDescendents(this, Fetch);
break;
case PacketType.UpdateInventoryItem:
UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
//Console.WriteLine(Pack.ToString());
for (int i = 0; i < update.InventoryData.Length; i++)
{
if (update.InventoryData[i].TransactionID != LLUUID.Zero)
{
AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
if (asset != null)
{
// Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
}
else
{
asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
if (asset != null)
{
//Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
}
else
{
//Console.WriteLine("trying to update inventory item, but asset is null");
}
}
}
else
{
m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
}
}
break;
case PacketType.ViewerEffect:
ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
foreach (SimClient client in m_clientThreads.Values)
{
if (client.AgentID != this.AgentID)
{
viewer.AgentData.AgentID = client.AgentID;
viewer.AgentData.SessionID = client.SessionID;
client.OutPacket(viewer);
}
}
break;
case PacketType.RequestTaskInventory:
// Console.WriteLine(Pack.ToString());
RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
bool foundent = false;
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == requesttask.InventoryData.LocalID)
{
replytask.InventoryData.TaskID = ent.uuid;
replytask.InventoryData.Serial = 0;
replytask.InventoryData.Filename = new byte[0];
foundent = true;
}
}
if (foundent)
{
this.OutPacket(replytask);
}
break;
case PacketType.UpdateTaskInventory:
// Console.WriteLine(Pack.ToString());
UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
if (myinventory != null)
{
if (updatetask.UpdateData.Key == 0)
{
if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
{
if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
{
LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
if (assBase != null)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == updatetask.UpdateData.LocalID)
{
if (ent is OpenSim.world.Primitive)
{
this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
}
}
}
}
}
}
}
}
break;
case PacketType.AgentAnimation:
if (!m_child)
{
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
for (int i = 0; i < AgentAni.AnimationList.Length; i++)
{
if (AgentAni.AnimationList[i].StartAnim)
{
ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
ClientAvatar.anim_seq = 1;
ClientAvatar.SendAnimPack();
}
}
}
break;
case PacketType.ObjectSelect:
ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
for (int i = 0; i < incomingselect.ObjectData.Length; i++)
{
foreach (Entity ent in m_world.Entities.Values)
{
if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
{
((OpenSim.world.Primitive)ent).GetProperites(this);
break;
}
}
}
break;
case PacketType.MapLayerRequest:
this.RequestMapLayer();
break;
case PacketType.MapBlockRequest:
MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
this.RequestMapBlock( MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
break;
case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 8; // tp via lm
this.OutPacket(tpStart);
TeleportProgressPacket tpProgress = new TeleportProgressPacket();
tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
this.OutPacket(tpProgress);
// Fetch landmark
LLUUID lmid = tpReq.Info.LandmarkID;
AssetBase lma = this.m_assetCache.GetAsset(lmid);
if (lma != null)
{
AssetLandmark lm = new AssetLandmark(lma);
if (lm.RegionID == m_regionData.SimUUID)
{
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpReq.Info.AgentID;
tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
tpLocal.Info.LocationID = 2;
tpLocal.Info.Position = lm.Position;
OutPacket(tpLocal);
}
else
{
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel);
}
}
else
{
Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel);
}
break;
case PacketType.TeleportLocationRequest:
TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
Console.WriteLine(tpLocReq.ToString());
tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 16; // Teleport via location
Console.WriteLine(tpStart.ToString());
OutPacket(tpStart);
if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
{
/* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */
Console.WriteLine("Inter-sim teleport not yet implemented");
TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
OutPacket(tpCancel);
}
else {
Console.WriteLine("Local teleport");
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID;
tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags;
tpLocal.Info.LocationID = 2;
tpLocal.Info.LookAt = tpLocReq.Info.LookAt;
tpLocal.Info.Position = tpLocReq.Info.Position;
OutPacket(tpLocal);
}
break;
}
}
}
private void ResendUnacked()
{
int now = Environment.TickCount;
@ -801,11 +408,11 @@ namespace OpenSim
if (Pack.Header.Zerocoded)
{
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
m_application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
}
else
{
m_application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
}
}
catch (Exception)
@ -900,7 +507,8 @@ namespace OpenSim
protected virtual void AuthUser()
{
AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
// AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
if (!sessionInfo.Authorised)
{
//session/circuit not authorised
@ -924,6 +532,16 @@ namespace OpenSim
// Create Inventory, currently only works for sandbox mode
if (m_sandboxMode)
{
this.SetupInventory(sessionInfo);
}
ClientLoop();
}
}
#region Inventory Creation
private void SetupInventory(AuthenticateResponse sessionInfo)
{
AgentInventory inventory = null;
if (sessionInfo.LoginInfo.InventoryFolder != null)
@ -950,11 +568,6 @@ namespace OpenSim
}
}
}
ClientLoop();
}
}
private AgentInventory CreateInventory(LLUUID baseFolder)
{
AgentInventory inventory = null;
@ -1015,6 +628,7 @@ namespace OpenSim
m_assetCache.AddAsset(asset);
m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
}
#endregion
public class QueItem
{

View File

@ -24,6 +24,8 @@ using OpenSim.GenericConfig;
namespace OpenSim
{
public delegate AuthenticateResponse AuthenticateSessionHandler(LLUUID sessionID, LLUUID agentID, uint circuitCode);
public class UDPServer : OpenSimNetworkHandler
{
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
@ -45,6 +47,7 @@ namespace OpenSim
private bool m_sandbox = false;
private bool user_accounts = false;
private ConsoleBase m_console;
public AuthenticateSessionHandler AuthenticateHandler;
public PacketServer PacketServer
{
@ -78,6 +81,7 @@ namespace OpenSim
this.user_accounts = accounts;
this.m_console = console;
PacketServer packetServer = new PacketServer(this);
this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_gridServers.GridServer.AuthenticateSession);
}
protected virtual void OnReceivedData(IAsyncResult result)
@ -178,5 +182,10 @@ namespace OpenSim
}
}
}
public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
{
return this.AuthenticateHandler(sessionID, agentID, circuitCode);
}
}
}

View File

@ -1,95 +0,0 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Nwc.XmlRpc;
using System.Collections;
using OpenSim.Framework.Console;
namespace OpenSim.Servers
{
public class OpenGridProtocolServer
{
private Thread m_workerThread;
private Socket m_listenerSocket;
private IPEndPoint m_IPendpoint;
private int m_port;
private ArrayList m_clients;
private class ClientHandler
{
private Thread m_clientThread;
private Socket m_socketHandle;
public ClientHandler(Socket clientSocketHandle)
{
m_socketHandle = clientSocketHandle;
m_clientThread = new Thread(new ThreadStart(DoWork));
m_clientThread.IsBackground = true;
m_clientThread.Start();
}
private void DoWork()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: ClientHandler.DoWork() - Got new client");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.NORMAL, "OpenSim 0.1, running OGS protocol 1.0");
}
private void WriteLine(string theline)
{
theline += "\n";
byte[] thelinebuffer = System.Text.Encoding.ASCII.GetBytes(theline.ToCharArray());
m_socketHandle.Send(thelinebuffer, theline.Length, 0);
}
}
public OpenGridProtocolServer(int port)
{
m_port = port;
}
public void Start()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: Start() - Opening server socket");
m_clients = new ArrayList();
m_workerThread = new Thread(new ThreadStart(StartServerSocket));
m_workerThread.IsBackground = true;
m_workerThread.Start();
}
private void StartServerSocket()
{
try
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.LOW,"OpenGridProtocol.cs: StartServerSocket() - Spawned main thread OK");
m_IPendpoint = new IPEndPoint(IPAddress.Any, m_port);
m_listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
m_listenerSocket.Bind(m_IPendpoint);
m_listenerSocket.Listen(4);
Socket sockethandle;
while (true)
{
sockethandle = m_listenerSocket.Accept();
lock (m_clients.SyncRoot)
{
m_clients.Add(new OpenGridProtocolServer.ClientHandler(sockethandle));
}
}
}
catch (Exception e)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.MEDIUM,e.Message);
}
}
}
}

View File

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{8BB20F0A-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>OpenSim.Servers</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<AppDesignerFolder></AppDesignerFolder>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>OpenSim.Servers</RootNamespace>
<StartupObject></StartupObject>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
@ -55,7 +61,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn></NoWarn>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
@ -110,9 +117,6 @@
<Compile Include="LoginServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenGridProtocol.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="XmlRpcMethod.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -17,7 +17,6 @@
<include name="LocalUserProfileManager.cs" />
<include name="LoginResponse.cs" />
<include name="LoginServer.cs" />
<include name="OpenGridProtocol.cs" />
<include name="XmlRpcMethod.cs" />
</sources>
<references basedir="${project::get-base-directory()}">