@@ -99,14 +99,14 @@ public class WebSocket : IDisposable
9999 private Queue < MessageEventArgs > _messageEventQueue ;
100100 private uint _nonceCount ;
101101 private string _origin ;
102+ private ManualResetEvent _pongReceived ;
102103 private bool _preAuth ;
103104 private string _protocol ;
104105 private string [ ] _protocols ;
105106 private bool _protocolsRequested ;
106107 private NetworkCredential _proxyCredentials ;
107108 private Uri _proxyUri ;
108109 private volatile WebSocketState _readyState ;
109- private ManualResetEvent _receivePong ;
110110 private int _retryCountForConnect ;
111111 private bool _secure ;
112112 private ClientSslConfiguration _sslConfig ;
@@ -1325,17 +1325,17 @@ private bool ping (byte[] data)
13251325 if ( _readyState != WebSocketState . Open )
13261326 return false ;
13271327
1328- var receivePong = _receivePong ;
1329- if ( receivePong == null )
1328+ var pongReceived = _pongReceived ;
1329+ if ( pongReceived == null )
13301330 return false ;
13311331
13321332 lock ( _forPing ) {
13331333 try {
1334- receivePong . Reset ( ) ;
1334+ pongReceived . Reset ( ) ;
13351335 if ( ! send ( Fin . Final , Opcode . Ping , data , false ) )
13361336 return false ;
13371337
1338- return receivePong . WaitOne ( _waitTime ) ;
1338+ return pongReceived . WaitOne ( _waitTime ) ;
13391339 }
13401340 catch ( ObjectDisposedException ) {
13411341 return false ;
@@ -1418,7 +1418,7 @@ private bool processPingFrame (WebSocketFrame frame)
14181418 private bool processPongFrame ( WebSocketFrame frame )
14191419 {
14201420 try {
1421- _receivePong . Set ( ) ;
1421+ _pongReceived . Set ( ) ;
14221422 }
14231423 catch ( NullReferenceException ) {
14241424 return false ;
@@ -1533,9 +1533,9 @@ private void releaseCommonResources ()
15331533 _inContinuation = false ;
15341534 }
15351535
1536- if ( _receivePong != null ) {
1537- _receivePong . Close ( ) ;
1538- _receivePong = null ;
1536+ if ( _pongReceived != null ) {
1537+ _pongReceived . Close ( ) ;
1538+ _pongReceived = null ;
15391539 }
15401540
15411541 if ( _exitReceiving != null ) {
@@ -1873,7 +1873,7 @@ private void startReceiving ()
18731873 _messageEventQueue . Clear ( ) ;
18741874
18751875 _exitReceiving = new ManualResetEvent ( false ) ;
1876- _receivePong = new ManualResetEvent ( false ) ;
1876+ _pongReceived = new ManualResetEvent ( false ) ;
18771877
18781878 Action receive = null ;
18791879 receive =
@@ -2190,13 +2190,13 @@ internal bool Ping (byte[] frameAsBytes, TimeSpan timeout)
21902190 if ( _readyState != WebSocketState . Open )
21912191 return false ;
21922192
2193- var receivePong = _receivePong ;
2194- if ( receivePong == null )
2193+ var pongReceived = _pongReceived ;
2194+ if ( pongReceived == null )
21952195 return false ;
21962196
21972197 lock ( _forPing ) {
21982198 try {
2199- receivePong . Reset ( ) ;
2199+ pongReceived . Reset ( ) ;
22002200
22012201 lock ( _forState ) {
22022202 if ( _readyState != WebSocketState . Open ) {
@@ -2208,7 +2208,7 @@ internal bool Ping (byte[] frameAsBytes, TimeSpan timeout)
22082208 return false ;
22092209 }
22102210
2211- return receivePong . WaitOne ( timeout ) ;
2211+ return pongReceived . WaitOne ( timeout ) ;
22122212 }
22132213 catch ( ObjectDisposedException ) {
22142214 return false ;
0 commit comments