mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-04 02:52:21 -04:00
Fix it to not error so much
This commit is contained in:
parent
cb26d3c9e2
commit
c03528ff5d
@ -492,7 +492,9 @@ namespace MCGalaxy.Network {
|
|||||||
public void Disconnect() { Disconnect(1000); }
|
public void Disconnect() { Disconnect(1000); }
|
||||||
public override void Close() { s.Close(); }
|
public override void Close() { s.Close(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SECURE_WEBSOCKETS
|
#if SECURE_WEBSOCKETS
|
||||||
|
// This code is unfinished and experimental, and is terrible quality. I apologise in advance.
|
||||||
public sealed class SecureSocket : INetSocket, INetProtocol {
|
public sealed class SecureSocket : INetSocket, INetProtocol {
|
||||||
readonly INetSocket raw;
|
readonly INetSocket raw;
|
||||||
WrapperStream wrapper;
|
WrapperStream wrapper;
|
||||||
@ -515,8 +517,16 @@ namespace MCGalaxy.Network {
|
|||||||
public override void Close() { raw.Close(); }
|
public override void Close() { raw.Close(); }
|
||||||
public void Disconnect() { Close(); }
|
public void Disconnect() { Close(); }
|
||||||
|
|
||||||
public override void Send(byte[] buffer, bool sync) { ssl.Write(buffer); }
|
// This is an extremely UGLY HACK
|
||||||
public override void SendLowPriority(byte[] buffer) { ssl.Write(buffer); }
|
readonly object locker = new object();
|
||||||
|
public override void Send(byte[] buffer, bool sync) {
|
||||||
|
try {
|
||||||
|
lock (locker) ssl.Write(buffer);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.LogError("Error writing to secure stream", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void SendLowPriority(byte[] buffer) { Send(buffer, false); }
|
||||||
|
|
||||||
public int ProcessReceived(byte[] data, int count) {
|
public int ProcessReceived(byte[] data, int count) {
|
||||||
lock (wrapper.locker) {
|
lock (wrapper.locker) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user