Skip to content

Commit 9374743

Browse files
committed
Make VncStream and VncStatisticsHelper fields readonly
Marked _c and _stats fields as readonly to ensure they are not reassigned after initialization. Also cleaned up comments and compacted exception throwing in the MaxUpdateRate setter.
1 parent 47e9001 commit 9374743

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

RemoteViewing/Vnc/VncClient.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,16 @@ public partial class VncClient
8383
/// </summary>
8484
public event EventHandler<RemoteClipboardChangedEventArgs> RemoteClipboardChanged;
8585

86-
private VncStream _c = new();
87-
private VncStatisticsHelper _stats = new();
86+
private readonly VncStream _c = new();
87+
private readonly VncStatisticsHelper _stats = new();
8888
private int[] _colorMap;
8989
private VncClientConnectOptions _options;
9090
private VncPixelFormat _pixelFormat;
9191
private Version _serverVersion = new();
9292
private Thread _threadMain;
93-
94-
// Reconnection state
9593
private string _hostname;
96-
9794
private int _port;
98-
private volatile bool _reconnecting;
95+
private volatile bool _reconnecting; // Reconnection state
9996
private volatile bool _stopReconnecting;
10097
private readonly object _reconnectLock = new();
10198

@@ -800,10 +797,7 @@ public double MaxUpdateRate
800797
set
801798
{
802799
if (value <= 0)
803-
{
804-
throw new ArgumentOutOfRangeException("Max update rate must be positive.",
805-
(Exception)null);
806-
}
800+
throw new ArgumentOutOfRangeException("Max update rate must be positive.", (Exception)null);
807801

808802
field = value;
809803
}

0 commit comments

Comments
 (0)