mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
*Revert ea1e16a
, should be done globally and not simply here
This commit is contained in:
parent
06606c5f01
commit
c38fbc0c09
6 changed files with 108 additions and 108 deletions
|
@ -83,8 +83,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
mConnectionHealthThread.Name = "MapThread:Health";
|
||||
//mConnectionHealthThread.Start();
|
||||
|
||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||
|
||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||
|
||||
gamedataItems = Database.getItemGamedata();
|
||||
Log.info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||
|
||||
|
@ -95,9 +95,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||
|
||||
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT);
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -146,8 +146,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
private void acceptCallback(IAsyncResult result)
|
||||
{
|
||||
ClientConnection conn = null;
|
||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||
|
||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -169,8 +169,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
catch (SocketException)
|
||||
{
|
||||
if (conn != null)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
|
@ -181,7 +181,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
catch (Exception)
|
||||
{
|
||||
if (conn != null)
|
||||
{
|
||||
{
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
|
@ -225,7 +225,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
}
|
||||
}
|
||||
if (conn.connType == BasePacket.TYPE_ZONE)
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
return;
|
||||
|
@ -243,36 +243,36 @@ namespace FFXIVClassic_Lobby_Server
|
|||
|
||||
//Build packets until can no longer or out of data
|
||||
while (true)
|
||||
{
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
||||
|
||||
//If can't build packet, break, else process another
|
||||
if (basePacket == null)
|
||||
break;
|
||||
else
|
||||
mProcessor.processPacket(conn, basePacket);
|
||||
}
|
||||
|
||||
//Not all bytes consumed, transfer leftover to beginning
|
||||
{
|
||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
||||
|
||||
//If can't build packet, break, else process another
|
||||
if (basePacket == null)
|
||||
break;
|
||||
else
|
||||
mProcessor.processPacket(conn, basePacket);
|
||||
}
|
||||
|
||||
//Not all bytes consumed, transfer leftover to beginning
|
||||
if (offset < bytesRead)
|
||||
Array.Copy(conn.buffer, offset, conn.buffer, 0, bytesRead - offset);
|
||||
|
||||
conn.lastPartialSize = bytesRead - offset;
|
||||
|
||||
//Build any queued subpackets into basepackets and send
|
||||
conn.flushQueuedSendPackets();
|
||||
|
||||
if (offset < bytesRead)
|
||||
//Need offset since not all bytes consumed
|
||||
conn.flushQueuedSendPackets();
|
||||
|
||||
if (offset < bytesRead)
|
||||
//Need offset since not all bytes consumed
|
||||
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
||||
else
|
||||
//All bytes consumed, full buffer available
|
||||
else
|
||||
//All bytes consumed, full buffer available
|
||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
|
@ -280,15 +280,15 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
{
|
||||
if (conn.socket != null)
|
||||
{
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
||||
|
||||
lock (mConnectionList)
|
||||
{
|
||||
mConnectionList.Remove(conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,23 +326,23 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
|
||||
return newPacket;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static WorldManager getWorldManager()
|
||||
{
|
||||
return mWorldManager;
|
||||
}
|
||||
|
||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
||||
{
|
||||
return mConnectedPlayerList;
|
||||
}
|
||||
|
||||
public static Dictionary<uint, Item> getItemGamedataList()
|
||||
{
|
||||
return gamedataItems;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static WorldManager GetWorldManager()
|
||||
{
|
||||
return mWorldManager;
|
||||
}
|
||||
|
||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
||||
{
|
||||
return mConnectedPlayerList;
|
||||
}
|
||||
|
||||
public static Dictionary<uint, Item> getItemGamedataList()
|
||||
{
|
||||
return gamedataItems;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue