[pgsqlclient-checkins] pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls SslClien
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-11-28 17:24:10
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv22740 Modified Files: SslClientStream.cs Log Message: 2003-11-28 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: - Added new exceptions. Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SslClientStream.cs 23 Nov 2003 12:50:08 -0000 1.6 --- SslClientStream.cs 28 Nov 2003 17:24:07 -0000 1.7 *************** *** 30,33 **** --- 30,34 ---- using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; + using System.Threading; using Mono.Security.Protocol.Tls.Alerts; *************** *** 70,73 **** --- 71,76 ---- private bool ownsStream; private bool disposed; + private string read; + private string write; #endregion *************** *** 257,260 **** --- 260,265 ---- this.innerStream = stream; this.ownsStream = ownsStream; + this.read = String.Empty; + this.write = String.Empty; } *************** *** 329,335 **** throw new ObjectDisposedException("The SslClientStream is closed."); } ! ! #warning "Throw exception: A read operation is already in progress." ! if (buffer == null) { --- 334,338 ---- throw new ObjectDisposedException("The SslClientStream is closed."); } ! if (buffer == null) { *************** *** 352,356 **** throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); } ! try { --- 355,362 ---- throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); } ! ! throw new NotSupportedException(); ! ! /* try { *************** *** 368,371 **** --- 374,378 ---- throw new IOException("An error occurred on the underlying stream. See the inner exception for details on the error.", ex); } + */ } *************** *** 391,400 **** } try { int readed = this.innerStream.EndRead(asyncResult); ! ! #warning "Decrypt readed data here" ! return readed; } --- 398,408 ---- } + throw new NotSupportedException(); + + /* try { int readed = this.innerStream.EndRead(asyncResult); ! return readed; } *************** *** 403,406 **** --- 411,415 ---- throw new IOException("An error occurred on the underlying stream. See the inner exception for details on the error.", ex); } + */ } *************** *** 436,442 **** throw new ObjectDisposedException("The SslClientStream is closed."); } ! ! #warning "Throw exception: A read operation is already in progress." ! if (!this.context.HandshakeFinished) { --- 445,449 ---- throw new ObjectDisposedException("The SslClientStream is closed."); } ! if (!this.context.HandshakeFinished) { *************** *** 465,471 **** throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); } ! try { // If actual buffer is full readed reset it if (this.inputBuffer.Position == this.inputBuffer.Length && --- 472,484 ---- throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); } ! ! if (!Monitor.TryEnter(this.read)) ! { ! throw new InvalidOperationException("A read operation is already in progress."); ! } try { + System.Threading.Monitor.Enter(this.read); + // If actual buffer is full readed reset it if (this.inputBuffer.Position == this.inputBuffer.Length && *************** *** 504,507 **** --- 517,524 ---- throw new IOException("IO exception during read.", ex); } + finally + { + System.Threading.Monitor.Exit(this.read); + } } *************** *** 528,533 **** } - #warning "Throw exception: A write operation is already in progress." - if (!this.context.HandshakeFinished) { --- 545,548 ---- *************** *** 557,562 **** --- 572,583 ---- } + if (!Monitor.TryEnter(this.write)) + { + throw new InvalidOperationException("A write operation is already in progress."); + } try { + Monitor.Enter(this.write); + // Send the buffer as a TLS record byte[] recordData = new byte[count]; *************** *** 573,576 **** --- 594,601 ---- throw new IOException("IO exception during Write.", ex); } + finally + { + Monitor.Exit(this.write); + } } |