* Unregister event handlers in LLUDPServer when a client logs out and disconnects

* Move ViewerEffect handling to Scene.PacketHandlers
* Removing the unused CloseAllAgents function
* Trimming ClientManager down. This class needs to be reworked to keep LLUDP circuit codes from intruding into the abstract OpenSim core code
prioritization
John Hurliman 2009-10-13 12:50:59 -07:00
parent f55b282078
commit c893761319
8 changed files with 267 additions and 415 deletions

View File

@ -34,20 +34,31 @@ using OpenMetaverse.Packets;
namespace OpenSim.Framework
{
public delegate void ForEachClientDelegate(IClientAPI client);
public class ClientManager
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<uint, IClientAPI> m_clients;
private Dictionary<uint, IClientAPI> m_clients = new Dictionary<uint, IClientAPI>();
public ClientManager()
public void Add(uint circuitCode, IClientAPI client)
{
m_clients = new Dictionary<uint, IClientAPI>();
lock (m_clients)
m_clients.Add(circuitCode, client);
}
public void ForEachClient(ForEachClientDelegate whatToDo)
public bool Remove(uint circuitCode)
{
lock (m_clients)
return m_clients.Remove(circuitCode);
}
public bool TryGetClient(uint circuitCode, out IClientAPI user)
{
lock (m_clients)
return m_clients.TryGetValue(circuitCode, out user);
}
public void ForEachClient(Action<IClientAPI> action)
{
IClientAPI[] LocalClients;
lock (m_clients)
@ -60,7 +71,7 @@ namespace OpenSim.Framework
{
try
{
whatToDo(LocalClients[i]);
action(LocalClients[i]);
}
catch (Exception e)
{
@ -68,153 +79,5 @@ namespace OpenSim.Framework
}
}
}
public void Remove(uint id)
{
lock (m_clients)
{
m_clients.Remove(id);
}
}
public void Add(uint id, IClientAPI client)
{
lock (m_clients)
{
m_clients.Add(id, client);
}
}
/// <summary>
/// Pass incoming packet to client.
/// </summary>
/// <param name="circuitCode">uint identifying the connection/client.</param>
/// <param name="packet">object containing the packet.</param>
public void InPacket(uint circuitCode, object packet)
{
IClientAPI client;
bool tryGetRet = false;
lock (m_clients)
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
if (tryGetRet)
{
client.InPacket(packet);
}
}
public void CloseAllAgents(uint circuitCode)
{
IClientAPI client;
bool tryGetRet = false;
lock (m_clients)
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
if (tryGetRet)
{
CloseAllCircuits(client.AgentId);
}
}
public void CloseAllCircuits(UUID agentId)
{
uint[] circuits = GetAllCircuits(agentId);
// We're using a for loop here so changes to the circuits don't cause it to completely fail.
for (int i = 0; i < circuits.Length; i++)
{
IClientAPI client;
try
{
bool tryGetRet = false;
lock (m_clients)
tryGetRet = m_clients.TryGetValue(circuits[i], out client);
if (tryGetRet)
{
Remove(client.CircuitCode);
client.Close(false);
}
}
catch (Exception e)
{
m_log.Error(string.Format("[CLIENT]: Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e));
}
}
}
// [Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")]
public uint[] GetAllCircuits(UUID agentId)
{
List<uint> circuits = new List<uint>();
// Wasteful, I know
IClientAPI[] LocalClients = new IClientAPI[0];
lock (m_clients)
{
LocalClients = new IClientAPI[m_clients.Count];
m_clients.Values.CopyTo(LocalClients, 0);
}
for (int i = 0; i < LocalClients.Length; i++)
{
if (LocalClients[i].AgentId == agentId)
{
circuits.Add(LocalClients[i].CircuitCode);
}
}
return circuits.ToArray();
}
public List<uint> GetAllCircuitCodes()
{
List<uint> circuits;
lock (m_clients)
{
circuits = new List<uint>(m_clients.Keys);
}
return circuits;
}
public void ViewerEffectHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args)
{
// TODO: don't create new blocks if recycling an old packet
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
effect.AgentID = args[i].AgentID;
effect.Color = args[i].Color;
effect.Duration = args[i].Duration;
effect.ID = args[i].ID;
effect.Type = args[i].Type;
effect.TypeData = args[i].TypeData;
effectBlock.Add(effect);
}
ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
IClientAPI[] LocalClients;
lock (m_clients)
{
LocalClients = new IClientAPI[m_clients.Count];
m_clients.Values.CopyTo(LocalClients, 0);
}
for (int i = 0; i < LocalClients.Length; i++)
{
if (LocalClients[i].AgentId != sender.AgentId)
{
LocalClients[i].SendViewerEffect(effectBlockArray);
}
}
}
public bool TryGetClient(uint circuitId, out IClientAPI user)
{
lock (m_clients)
{
return m_clients.TryGetValue(circuitId, out user);
}
}
}
}

View File

@ -71,7 +71,6 @@ namespace OpenSim.Framework
void AddNewClient(IClientAPI client);
void RemoveClient(UUID agentID);
void CloseAllAgents(uint circuitcode);
void Restart(int seconds);
//RegionInfo OtherRegionUp(RegionInfo thisRegion);

View File

@ -58,6 +58,209 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
{
#region Events
public event GenericMessage OnGenericMessage;
public event BinaryGenericMessage OnBinaryGenericMessage;
public event Action<IClientAPI> OnLogout;
public event ObjectPermissions OnObjectPermissions;
public event Action<IClientAPI> OnConnectionClosed;
public event ViewerEffectEventHandler OnViewerEffect;
public event ImprovedInstantMessage OnInstantMessage;
public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event DeRezObject OnDeRezObject;
public event ModifyTerrain OnModifyTerrain;
public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall2 OnRequestWearables;
public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
public event UUIDNameRequest OnDetachAttachmentIntoInv;
public event ObjectAttach OnObjectAttach;
public event ObjectDeselect OnObjectDetach;
public event ObjectDrop OnObjectDrop;
public event GenericCall2 OnCompleteMovementToRegion;
public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit;
public event AgentSit OnAgentSit;
public event AvatarPickerRequest OnAvatarPickerRequest;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event Action<IClientAPI> OnRequestAvatarsData;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event GrabObject OnGrabObject;
public event DeGrabObject OnDeGrabObject;
public event SpinStart OnSpinStart;
public event SpinStop OnSpinStop;
public event ObjectDuplicate OnObjectDuplicate;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
public event MoveObject OnGrabUpdate;
public event SpinObject OnSpinUpdate;
public event AddNewPrim OnAddPrim;
public event RequestGodlikePowers OnRequestGodlikePowers;
public event GodKickUser OnGodKickUser;
public event ObjectExtraParams OnUpdateExtraParams;
public event UpdateShape OnUpdatePrimShape;
public event ObjectRequest OnObjectRequest;
public event ObjectSelect OnObjectSelect;
public event ObjectDeselect OnObjectDeselect;
public event GenericCall7 OnObjectDescription;
public event GenericCall7 OnObjectName;
public event GenericCall7 OnObjectClickAction;
public event GenericCall7 OnObjectMaterial;
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
public event UpdatePrimFlags OnUpdatePrimFlags;
public event UpdatePrimTexture OnUpdatePrimTexture;
public event UpdateVector OnUpdatePrimGroupPosition;
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;
public event StatusChange OnChildAgentStatus;
public event GenericCall2 OnStopMovement;
public event Action<UUID> OnRemoveAvatar;
public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest;
public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun;
public event FetchInventory OnAgentDataUpdateRequest;
public event TeleportLocationRequest OnSetStartLocationRequest;
public event UpdateAvatarProperties OnUpdateAvatarProperties;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem;
public event CopyInventoryItem OnCopyInventoryItem;
public event MoveInventoryItem OnMoveInventoryItem;
public event RemoveInventoryItem OnRemoveInventoryItem;
public event RemoveInventoryFolder OnRemoveInventoryFolder;
public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer;
public event ConfirmXfer OnConfirmXfer;
public event AbortXfer OnAbortXfer;
public event RequestTerrain OnRequestTerrain;
public event RezScript OnRezScript;
public event UpdateTaskInventory OnUpdateTaskInventory;
public event MoveTaskInventory OnMoveTaskItem;
public event RemoveTaskInventory OnRemoveTaskItem;
public event RequestAsset OnRequestAsset;
public event UUIDNameRequest OnNameFromUUIDRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelGodForceOwner OnParcelGodForceOwner;
public event ParcelReclaim OnParcelReclaim;
public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
public event ParcelDeedToGroup OnParcelDeedToGroup;
public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest;
public event FriendActionDelegate OnApproveFriendRequest;
public event FriendActionDelegate OnDenyFriendRequest;
public event FriendshipTermination OnTerminateFriendship;
public event MoneyTransferRequest OnMoneyTransferRequest;
public event EconomyDataRequest OnEconomyDataRequest;
public event MoneyBalanceRequest OnMoneyBalanceRequest;
public event ParcelBuy OnParcelBuy;
public event UUIDNameRequest OnTeleportHomeRequest;
public event UUIDNameRequest OnUUIDGroupNameRequest;
public event ScriptAnswer OnScriptAnswer;
public event RequestPayPrice OnRequestPayPrice;
public event ObjectSaleInfo OnObjectSaleInfo;
public event ObjectBuy OnObjectBuy;
public event BuyObjectInventory OnBuyObjectInventory;
public event AgentSit OnUndo;
public event ForceReleaseControls OnForceReleaseControls;
public event GodLandStatRequest OnLandStatRequest;
public event RequestObjectPropertiesFamily OnObjectGroupRequest;
public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
public event BakeTerrain OnBakeTerrain;
public event RequestTerrain OnUploadTerrain;
public event EstateChangeInfo OnEstateChangeInfo;
public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
public event RegionHandleRequest OnRegionHandleRequest;
public event ParcelInfoRequest OnParcelInfoRequest;
public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning;
public event UpdateVector OnAutoPilotGo;
public event TerrainUnacked OnUnackedTerrain;
public event ActivateGesture OnActivateGesture;
public event DeactivateGesture OnDeactivateGesture;
public event ObjectOwner OnObjectOwner;
public event DirPlacesQuery OnDirPlacesQuery;
public event DirFindQuery OnDirFindQuery;
public event DirLandQuery OnDirLandQuery;
public event DirPopularQuery OnDirPopularQuery;
public event DirClassifiedQuery OnDirClassifiedQuery;
public event EventInfoRequest OnEventInfoRequest;
public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
public event MapItemRequest OnMapItemRequest;
public event OfferCallingCard OnOfferCallingCard;
public event AcceptCallingCard OnAcceptCallingCard;
public event DeclineCallingCard OnDeclineCallingCard;
public event SoundTrigger OnSoundTrigger;
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
public event ClassifiedInfoRequest OnClassifiedInfoRequest;
public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
public event ClassifiedDelete OnClassifiedDelete;
public event ClassifiedDelete OnClassifiedGodDelete;
public event EventNotificationAddRequest OnEventNotificationAddRequest;
public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
public event EventGodDelete OnEventGodDelete;
public event ParcelDwellRequest OnParcelDwellRequest;
public event UserInfoRequest OnUserInfoRequest;
public event UpdateUserInfo OnUpdateUserInfo;
public event RetrieveInstantMessages OnRetrieveInstantMessages;
public event PickDelete OnPickDelete;
public event PickGodDelete OnPickGodDelete;
public event PickInfoUpdate OnPickInfoUpdate;
public event AvatarNotesUpdate OnAvatarNotesUpdate;
public event MuteListRequest OnMuteListRequest;
public event AvatarInterestUpdate OnAvatarInterestUpdate;
public event PlacesQuery OnPlacesQuery;
#endregion Events
#region Class Members
// LLClientView Only
public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
@ -114,9 +317,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected int m_textureDataLimit = 10;
protected int m_avatarTerseUpdateRate = 50;
protected int m_avatarTerseUpdatesPerPacket = 5;
protected int m_packetMTU = 1400;
protected IAssetService m_assetService;
#endregion Class Members
#region Properties
public LLUDPClient UDPClient { get { return m_udpClient; } }
@ -413,34 +617,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return result;
}
/*protected void DebugPacket(string direction, Packet packet)
{
string info;
if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate)
return;
if (m_debugPacketLevel < 254 && packet.Type == PacketType.ViewerEffect)
return;
if (m_debugPacketLevel < 253 && (
packet.Type == PacketType.CompletePingCheck ||
packet.Type == PacketType.StartPingCheck
))
return;
if (m_debugPacketLevel < 252 && packet.Type == PacketType.PacketAck)
return;
if (m_debugPacketLevel > 1)
{
info = packet.ToString();
}
else
{
info = packet.Type.ToString();
}
Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
}*/
#endregion Packet Handling
# region Setup
@ -523,207 +699,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
# endregion
#region Events
public event GenericMessage OnGenericMessage;
public event BinaryGenericMessage OnBinaryGenericMessage;
public event Action<IClientAPI> OnLogout;
public event ObjectPermissions OnObjectPermissions;
public event Action<IClientAPI> OnConnectionClosed;
public event ViewerEffectEventHandler OnViewerEffect;
public event ImprovedInstantMessage OnInstantMessage;
public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event DeRezObject OnDeRezObject;
public event ModifyTerrain OnModifyTerrain;
public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall2 OnRequestWearables;
public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
public event UUIDNameRequest OnDetachAttachmentIntoInv;
public event ObjectAttach OnObjectAttach;
public event ObjectDeselect OnObjectDetach;
public event ObjectDrop OnObjectDrop;
public event GenericCall2 OnCompleteMovementToRegion;
public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit;
public event AgentSit OnAgentSit;
public event AvatarPickerRequest OnAvatarPickerRequest;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event Action<IClientAPI> OnRequestAvatarsData;
public event LinkObjects OnLinkObjects;
public event DelinkObjects OnDelinkObjects;
public event GrabObject OnGrabObject;
public event DeGrabObject OnDeGrabObject;
public event SpinStart OnSpinStart;
public event SpinStop OnSpinStop;
public event ObjectDuplicate OnObjectDuplicate;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
public event MoveObject OnGrabUpdate;
public event SpinObject OnSpinUpdate;
public event AddNewPrim OnAddPrim;
public event RequestGodlikePowers OnRequestGodlikePowers;
public event GodKickUser OnGodKickUser;
public event ObjectExtraParams OnUpdateExtraParams;
public event UpdateShape OnUpdatePrimShape;
public event ObjectRequest OnObjectRequest;
public event ObjectSelect OnObjectSelect;
public event ObjectDeselect OnObjectDeselect;
public event GenericCall7 OnObjectDescription;
public event GenericCall7 OnObjectName;
public event GenericCall7 OnObjectClickAction;
public event GenericCall7 OnObjectMaterial;
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
public event UpdatePrimFlags OnUpdatePrimFlags;
public event UpdatePrimTexture OnUpdatePrimTexture;
public event UpdateVector OnUpdatePrimGroupPosition;
public event UpdateVector OnUpdatePrimSinglePosition;
public event UpdatePrimRotation OnUpdatePrimGroupRotation;
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;
public event StatusChange OnChildAgentStatus;
public event GenericCall2 OnStopMovement;
public event Action<UUID> OnRemoveAvatar;
public event RequestMapBlocks OnRequestMapBlocks;
public event RequestMapName OnMapNameRequest;
public event TeleportLocationRequest OnTeleportLocationRequest;
public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
public event DisconnectUser OnDisconnectUser;
public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun;
public event FetchInventory OnAgentDataUpdateRequest;
public event TeleportLocationRequest OnSetStartLocationRequest;
public event UpdateAvatarProperties OnUpdateAvatarProperties;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory;
public event RequestTaskInventory OnRequestTaskInventory;
public event UpdateInventoryItem OnUpdateInventoryItem;
public event CopyInventoryItem OnCopyInventoryItem;
public event MoveInventoryItem OnMoveInventoryItem;
public event RemoveInventoryItem OnRemoveInventoryItem;
public event RemoveInventoryFolder OnRemoveInventoryFolder;
public event UDPAssetUploadRequest OnAssetUploadRequest;
public event XferReceive OnXferReceive;
public event RequestXfer OnRequestXfer;
public event ConfirmXfer OnConfirmXfer;
public event AbortXfer OnAbortXfer;
public event RequestTerrain OnRequestTerrain;
public event RezScript OnRezScript;
public event UpdateTaskInventory OnUpdateTaskInventory;
public event MoveTaskInventory OnMoveTaskItem;
public event RemoveTaskInventory OnRemoveTaskItem;
public event RequestAsset OnRequestAsset;
public event UUIDNameRequest OnNameFromUUIDRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelGodForceOwner OnParcelGodForceOwner;
public event ParcelReclaim OnParcelReclaim;
public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
public event ParcelDeedToGroup OnParcelDeedToGroup;
public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest;
public event FriendActionDelegate OnApproveFriendRequest;
public event FriendActionDelegate OnDenyFriendRequest;
public event FriendshipTermination OnTerminateFriendship;
public event MoneyTransferRequest OnMoneyTransferRequest;
public event EconomyDataRequest OnEconomyDataRequest;
public event MoneyBalanceRequest OnMoneyBalanceRequest;
public event ParcelBuy OnParcelBuy;
public event UUIDNameRequest OnTeleportHomeRequest;
public event UUIDNameRequest OnUUIDGroupNameRequest;
public event ScriptAnswer OnScriptAnswer;
public event RequestPayPrice OnRequestPayPrice;
public event ObjectSaleInfo OnObjectSaleInfo;
public event ObjectBuy OnObjectBuy;
public event BuyObjectInventory OnBuyObjectInventory;
public event AgentSit OnUndo;
public event ForceReleaseControls OnForceReleaseControls;
public event GodLandStatRequest OnLandStatRequest;
public event RequestObjectPropertiesFamily OnObjectGroupRequest;
public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
public event BakeTerrain OnBakeTerrain;
public event RequestTerrain OnUploadTerrain;
public event EstateChangeInfo OnEstateChangeInfo;
public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
public event RegionHandleRequest OnRegionHandleRequest;
public event ParcelInfoRequest OnParcelInfoRequest;
public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning;
public event UpdateVector OnAutoPilotGo;
public event TerrainUnacked OnUnackedTerrain;
public event ActivateGesture OnActivateGesture;
public event DeactivateGesture OnDeactivateGesture;
public event ObjectOwner OnObjectOwner;
public event DirPlacesQuery OnDirPlacesQuery;
public event DirFindQuery OnDirFindQuery;
public event DirLandQuery OnDirLandQuery;
public event DirPopularQuery OnDirPopularQuery;
public event DirClassifiedQuery OnDirClassifiedQuery;
public event EventInfoRequest OnEventInfoRequest;
public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
public event MapItemRequest OnMapItemRequest;
public event OfferCallingCard OnOfferCallingCard;
public event AcceptCallingCard OnAcceptCallingCard;
public event DeclineCallingCard OnDeclineCallingCard;
public event SoundTrigger OnSoundTrigger;
public event StartLure OnStartLure;
public event TeleportLureRequest OnTeleportLureRequest;
public event NetworkStats OnNetworkStatsUpdate;
public event ClassifiedInfoRequest OnClassifiedInfoRequest;
public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
public event ClassifiedDelete OnClassifiedDelete;
public event ClassifiedDelete OnClassifiedGodDelete;
public event EventNotificationAddRequest OnEventNotificationAddRequest;
public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
public event EventGodDelete OnEventGodDelete;
public event ParcelDwellRequest OnParcelDwellRequest;
public event UserInfoRequest OnUserInfoRequest;
public event UpdateUserInfo OnUpdateUserInfo;
public event RetrieveInstantMessages OnRetrieveInstantMessages;
public event PickDelete OnPickDelete;
public event PickGodDelete OnPickGodDelete;
public event PickInfoUpdate OnPickInfoUpdate;
public event AvatarNotesUpdate OnAvatarNotesUpdate;
public event MuteListRequest OnMuteListRequest;
public event AvatarInterestUpdate OnAvatarInterestUpdate;
public event PlacesQuery OnPlacesQuery;
#endregion Events
public void ActivateGesture(UUID assetId, UUID gestureId)
{
}
@ -3367,7 +3342,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int length = 0;
m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > m_packetMTU)
if (size + length > Packet.MTU)
break;
size += length;
}
@ -3611,7 +3586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int length = 0;
m_primFullUpdates[count].ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > m_packetMTU)
if (size + length > Packet.MTU)
break;
size += length;
}
@ -3699,7 +3674,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int length = 0;
m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > m_packetMTU)
if (size + length > Packet.MTU)
break;
size += length;
}
@ -4802,7 +4777,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack)
{
ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack;
if (ogpack.AgentData.SessionID != SessionId) return false;

View File

@ -419,7 +419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int dataLength = buffer.DataLength;
// Keep appending ACKs until there is no room left in the packet or there are
// Keep appending ACKs until there is no room left in the buffer or there are
// no more ACKs to append
uint ackCount = 0;
uint ack;
@ -654,11 +654,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Create the LLClientView
LLClientView clientApi = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
clientApi.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
clientApi.OnLogout += LogoutHandler;
clientApi.OnConnectionClosed +=
delegate(IClientAPI client)
{ if (client is LLClientView) RemoveClient(((LLClientView)client).UDPClient); };
clientApi.OnConnectionClosed += ConnectionClosedHandler;
// Start the IClientAPI
m_scene.ClientManager.Add(circuitCode, clientApi);
@ -808,7 +805,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void LogoutHandler(IClientAPI client)
{
client.OnLogout -= LogoutHandler;
client.SendLogoutPacket();
if (client is LLClientView)
RemoveClient(((LLClientView)client).UDPClient);
}
private void ConnectionClosedHandler(IClientAPI client)
{
client.OnConnectionClosed -= ConnectionClosedHandler;
if (client is LLClientView)
RemoveClient(((LLClientView)client).UDPClient);
}

View File

@ -391,6 +391,32 @@ namespace OpenSim.Region.Framework.Scenes
}
}
void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
{
// TODO: don't create new blocks if recycling an old packet
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
effect.AgentID = args[i].AgentID;
effect.Color = args[i].Color;
effect.Duration = args[i].Duration;
effect.ID = args[i].ID;
effect.Type = args[i].Type;
effect.TypeData = args[i].TypeData;
effectBlock.Add(effect);
}
ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
ClientManager.ForEachClient(
delegate(IClientAPI client)
{
if (client.AgentId != remoteClient.AgentId)
client.SendViewerEffect(effectBlockArray);
}
);
}
/// <summary>
/// Handle a fetch inventory request from the client
/// </summary>

View File

@ -2572,6 +2572,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
{
client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
client.OnViewerEffect += ProcessViewerEffect;
}
protected virtual void UnsubscribeToClientEvents(IClientAPI client)
@ -2726,11 +2727,9 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
{
client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
client.OnViewerEffect -= ProcessViewerEffect;
}
/// <summary>
/// Teleport an avatar to their home region
/// </summary>
@ -3052,16 +3051,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Closes all endpoints with the circuitcode provided.
/// </summary>
/// <param name="circuitcode">Circuit Code of the endpoint to close</param>
public override void CloseAllAgents(uint circuitcode)
{
// Called by ClientView to kill all circuit codes
ClientManager.CloseAllAgents(circuitcode);
}
/// <summary>
/// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
/// </summary>

View File

@ -196,8 +196,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param>
public abstract void RemoveClient(UUID agentID);
public abstract void CloseAllAgents(uint circuitcode);
#endregion
/// <summary>

View File

@ -61,11 +61,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
throw new NotImplementedException();
}
public override void CloseAllAgents(uint circuitcode)
{
throw new NotImplementedException();
}
public override void OtherRegionUp(GridRegion otherRegion)
{
throw new NotImplementedException();