You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 23:56:30 +09:00
Logging error instead of throwing exception on network thread in RELEASE
Removed superflous break Added new keyword to ReadByte() - not optimal, but it will have to do for now
This commit is contained in:
@@ -639,7 +639,6 @@ namespace Lidgren.Network
|
|||||||
case NetDeliveryMethod.Unknown:
|
case NetDeliveryMethod.Unknown:
|
||||||
default:
|
default:
|
||||||
throw new NetException("Bad delivery method!");
|
throw new NetException("Bad delivery method!");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_owner == null)
|
if (m_owner == null)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Lidgren.Network
|
|||||||
//
|
//
|
||||||
// 8 bit
|
// 8 bit
|
||||||
//
|
//
|
||||||
public byte ReadByte()
|
public new byte ReadByte()
|
||||||
{
|
{
|
||||||
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
|
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
|
||||||
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
|
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
|
||||||
@@ -83,6 +83,7 @@ namespace Lidgren.Network
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[CLSCompliant(false)]
|
[CLSCompliant(false)]
|
||||||
public sbyte ReadSByte()
|
public sbyte ReadSByte()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace Lidgren.Network
|
|||||||
|
|
||||||
int first = (pa == null ? this.GetHashCode() : pa.GetHashCode());
|
int first = (pa == null ? this.GetHashCode() : pa.GetHashCode());
|
||||||
int second = boundEp.GetHashCode();
|
int second = boundEp.GetHashCode();
|
||||||
|
|
||||||
byte[] raw = new byte[8];
|
byte[] raw = new byte[8];
|
||||||
raw[0] = (byte)first;
|
raw[0] = (byte)first;
|
||||||
raw[1] = (byte)(first << 8);
|
raw[1] = (byte)(first << 8);
|
||||||
@@ -139,21 +139,45 @@ namespace Lidgren.Network
|
|||||||
m_receiveBuffer = new byte[m_configuration.ReceiveBufferSize];
|
m_receiveBuffer = new byte[m_configuration.ReceiveBufferSize];
|
||||||
m_sendBuffer = new byte[m_configuration.SendBufferSize];
|
m_sendBuffer = new byte[m_configuration.SendBufferSize];
|
||||||
|
|
||||||
LogVerbose("Initialization done");
|
throw new Exception("borak!");
|
||||||
|
|
||||||
// only set Running if everything succeeds
|
// only set Running if everything succeeds
|
||||||
m_status = NetPeerStatus.Running;
|
m_status = NetPeerStatus.Running;
|
||||||
|
|
||||||
|
LogVerbose("Initialization done");
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
#else
|
||||||
catch (SocketException sex)
|
catch (SocketException sex)
|
||||||
{
|
{
|
||||||
|
// catastrophic failure; we can't know what's been initialized, try to back out
|
||||||
|
m_status = NetPeerStatus.NotRunning;
|
||||||
|
|
||||||
if (sex.SocketErrorCode == SocketError.AddressAlreadyInUse)
|
if (sex.SocketErrorCode == SocketError.AddressAlreadyInUse)
|
||||||
throw new NetException("Failed to bind to port " + (iep == null ? "Null" : iep.ToString()) + " - Address already in use!", sex);
|
LogError("Failed to bind to port " + (iep == null ? "Null" : iep.ToString()) + " - Address already in use!");
|
||||||
throw;
|
else
|
||||||
|
LogError(sex.Message);
|
||||||
|
LogError("Lidgren could not initialize properly; please call Start() again");
|
||||||
|
|
||||||
|
// exit thread
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new NetException("Failed to bind to " + (iep == null ? "Null" : iep.ToString()), ex);
|
// catastrophic failure; we can't know what's been initialized, try to back out
|
||||||
|
m_status = NetPeerStatus.NotRunning;
|
||||||
|
|
||||||
|
LogError(ex.Message);
|
||||||
|
LogError("Lidgren could not initialize properly; please call Start() again");
|
||||||
|
|
||||||
|
// exit thread
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user