本文整理汇总了C#中IClientAPI.Close方法的典型用法代码示例。如果您正苦于以下问题:C# IClientAPI.Close方法的具体用法?C# IClientAPI.Close怎么用?C# IClientAPI.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClientAPI
的用法示例。
在下文中一共展示了IClientAPI.Close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewClient
/// <summary>
/// Adding a New Client and Create a Presence for it.
/// </summary>
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client)
{
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
bool vialogin = false;
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
return;
m_clientManager.Add(client);
SubscribeToClientEvents(client);
// Do the verification here
System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
if (!VerifyClient(aCircuit, ep, out vialogin))
{
// uh-oh, this is fishy
m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
client.AgentId, client.SessionId, ep.ToString());
try
{
client.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace);
}
return;
}
//m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
ScenePresence sp = CreateAndAddScenePresence(client);
if (aCircuit != null)
sp.Appearance = aCircuit.Appearance;
// HERE!!! Do the initial attachments right here
// first agent upon login is a root agent by design.
// All other AddNewClient calls find aCircuit.child to be true
if (aCircuit.child == false)
{
sp.IsChildAgent = false;
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
}
if (GetScenePresence(client.AgentId) != null)
{
m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client);
if (vialogin)
EventManager.TriggerOnClientLogin(client);
}
if (!sp.IsChildAgent && Stats is OpenSim.Framework.Statistics.SimExtraStatsCollector)
{
OpenSim.Framework.Statistics.SimExtraStatsCollector stats = Stats as OpenSim.Framework.Statistics.SimExtraStatsCollector;
stats.AddSuccessfulLogin();
}
}
示例2: LogoutHandler
protected void LogoutHandler(IClientAPI client)
{
client.SendLogoutPacket();
if (!client.IsLoggingOut)
{
client.IsLoggingOut = true;
client.Close();
}
}
示例3: DeactivateClientDueToTimeout
/// <summary>
/// Deactivates the client if we don't receive any packets within a certain amount of time (default 60 seconds).
/// </summary>
/// <remarks>
/// If a connection is active then we will always receive packets even if nothing else is happening, due to
/// regular client pings.
/// </remarks>
/// <param name='client'></param>
private void DeactivateClientDueToTimeout(IClientAPI client)
{
// We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even
// though it's set later on by LLClientView.Close()
client.IsActive = false;
m_log.WarnFormat(
"[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}",
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName);
StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout");
client.Close();
}
示例4: AddNewClient
/// <summary>
/// Adding a New Client and Create a Presence for it.
/// </summary>
/// <param name="client"></param>
public override void AddNewClient(IClientAPI client)
{
bool vialogin = false;
m_clientManager.Add(client);
CheckHeartbeat();
SubscribeToClientEvents(client);
ScenePresence presence;
if (m_restorePresences.ContainsKey(client.AgentId))
{
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
presence = m_restorePresences[client.AgentId];
m_restorePresences.Remove(client.AgentId);
// This is one of two paths to create avatars that are
// used. This tends to get called more in standalone
// than grid, not really sure why, but as such needs
// an explicity appearance lookup here.
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);
presence.Appearance = appearance;
presence.initializeScenePresence(client, RegionInfo, this);
m_sceneGraph.AddScenePresence(presence);
lock (m_restorePresences)
{
Monitor.PulseAll(m_restorePresences);
}
}
else
{
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
// Do the verification here
System.Net.EndPoint ep = client.GetClientEP();
if (aCircuit != null)
{
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
{
m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
vialogin = true;
IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
if (userVerification != null && ep != null)
{
if (!userVerification.VerifyClient(aCircuit, ep.ToString()))
{
// uh-oh, this is fishy
m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
client.AgentId, client.SessionId, ep.ToString());
try
{
client.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace);
}
return;
}
else
m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname);
}
}
}
m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
ScenePresence sp = CreateAndAddScenePresence(client);
if (aCircuit != null)
sp.Appearance = aCircuit.Appearance;
// HERE!!! Do the initial attachments right here
// first agent upon login is a root agent by design.
// All other AddNewClient calls find aCircuit.child to be true
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
{
sp.IsChildAgent = false;
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
}
}
m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client);
if (vialogin)
EventManager.TriggerOnClientLogin(client);
}
示例5: RemoveClient
private void RemoveClient(IClientAPI client)
{
try
{
client.Close();
}
catch (Exception e)
{
m_log.Error("[LLUDPSERVER] RemoveClient exception: " + e.ToString());
}
}
示例6: CloseClient
/// <summary>
/// Completely close down the given client.
/// </summary>
/// <param name="client"></param>
public virtual void CloseClient(IClientAPI client)
{
//m_log.Info("PacketServer:CloseClient()");
CloseCircuit(client.CircuitCode);
m_scene.ClientManager.Remove(client.CircuitCode);
client.Close(false);
}