1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +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:
lidgren
2010-08-10 11:21:56 +00:00
parent a5ab4ab485
commit 04b7647bfb
3 changed files with 31 additions and 7 deletions

View File

@@ -639,7 +639,6 @@ namespace Lidgren.Network
case NetDeliveryMethod.Unknown:
default:
throw new NetException("Bad delivery method!");
break;
}
if (m_owner == null)

View File

@@ -75,7 +75,7 @@ namespace Lidgren.Network
//
// 8 bit
//
public byte ReadByte()
public new byte ReadByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
@@ -83,6 +83,7 @@ namespace Lidgren.Network
return retval;
}
[CLSCompliant(false)]
public sbyte ReadSByte()
{

View File

@@ -124,7 +124,7 @@ namespace Lidgren.Network
int first = (pa == null ? this.GetHashCode() : pa.GetHashCode());
int second = boundEp.GetHashCode();
byte[] raw = new byte[8];
raw[0] = (byte)first;
raw[1] = (byte)(first << 8);
@@ -139,21 +139,45 @@ namespace Lidgren.Network
m_receiveBuffer = new byte[m_configuration.ReceiveBufferSize];
m_sendBuffer = new byte[m_configuration.SendBufferSize];
LogVerbose("Initialization done");
throw new Exception("borak!");
// only set Running if everything succeeds
m_status = NetPeerStatus.Running;
LogVerbose("Initialization done");
}
#if DEBUG
catch(Exception ex)
{
throw;
}
#else
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)
throw new NetException("Failed to bind to port " + (iep == null ? "Null" : iep.ToString()) + " - Address already in use!", sex);
throw;
LogError("Failed to bind to port " + (iep == null ? "Null" : iep.ToString()) + " - Address already in use!");
else
LogError(sex.Message);
LogError("Lidgren could not initialize properly; please call Start() again");
// exit thread
return;
}
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
}
//