fix WebSocket.cs, WsStream.cs, wsclient.cs
This commit is contained in:
@@ -30,9 +30,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#if NOTIFY
|
||||
using Notifications;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -109,13 +106,7 @@ namespace WebSocketSharp
|
||||
private SslStream sslStream;
|
||||
private IWsStream wsStream;
|
||||
private Thread msgThread;
|
||||
#if NOTIFY
|
||||
private Notification msgNf;
|
||||
public Notification MsgNf
|
||||
{
|
||||
get { return msgNf; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public event EventHandler OnOpen;
|
||||
public event MessageEventHandler OnMessage;
|
||||
public event MessageEventHandler OnError;
|
||||
@@ -205,11 +196,6 @@ namespace WebSocketSharp
|
||||
|
||||
readyState = state;
|
||||
|
||||
if (OnClose != null)
|
||||
{
|
||||
OnClose(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
if (wsStream != null && tcpClient.Connected)
|
||||
{
|
||||
try
|
||||
@@ -228,7 +214,7 @@ namespace WebSocketSharp
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (wsStream != null)
|
||||
{
|
||||
wsStream.Dispose();
|
||||
@@ -240,6 +226,14 @@ namespace WebSocketSharp
|
||||
tcpClient.Close();
|
||||
tcpClient = null;
|
||||
}
|
||||
|
||||
if (OnClose != null)
|
||||
{
|
||||
OnClose(this, EventArgs.Empty);
|
||||
}
|
||||
#if DEBUG
|
||||
Console.WriteLine("WS: Info @close: Exit close method.");
|
||||
#endif
|
||||
}
|
||||
|
||||
private void createConnection()
|
||||
@@ -355,10 +349,6 @@ namespace WebSocketSharp
|
||||
Console.WriteLine("WS: Info @message: Current thread IsBackground: {0}", Thread.CurrentThread.IsBackground);
|
||||
#endif
|
||||
string data;
|
||||
#if NOTIFY
|
||||
this.msgNf = new Notification();
|
||||
msgNf.AddHint("append", "allowed");
|
||||
#endif
|
||||
while (readyState == WsState.OPEN)
|
||||
{
|
||||
data = receive();
|
||||
@@ -435,7 +425,7 @@ namespace WebSocketSharp
|
||||
OnError(this, e.Message);
|
||||
}
|
||||
|
||||
ReadyState = WsState.CLOSING;
|
||||
ReadyState = WsState.CLOSED;
|
||||
#if DEBUG
|
||||
Console.WriteLine("WS: Error @receive: {0}", e.Message);
|
||||
#endif
|
||||
|
@@ -42,16 +42,16 @@ namespace WebSocketSharp
|
||||
|
||||
public WsStream(T innerStream)
|
||||
{
|
||||
if (innerStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("innerStream");
|
||||
}
|
||||
|
||||
Type streamType = innerStream.GetType();
|
||||
Type streamType = typeof(T);
|
||||
if (streamType != typeof(NetworkStream) &&
|
||||
streamType != typeof(SslStream))
|
||||
{
|
||||
throw new ArgumentException("Unsupported Stream type: " + streamType.ToString());
|
||||
throw new NotSupportedException("Unsupported Stream type: " + streamType.ToString());
|
||||
}
|
||||
|
||||
if (innerStream == null)
|
||||
{
|
||||
throw new ArgumentNullException("innerStream");
|
||||
}
|
||||
|
||||
this.innerStream = innerStream;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,7 +34,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug_Ubuntu</OutputPath>
|
||||
<DefineConstants>DEBUG,NOTIFY</DefineConstants>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
@@ -46,7 +46,6 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<DefineConstants>NOTIFY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user