[pgsqlclient-checkins] pgsqlclient_10/PgSqlClient.Security.Tls/source TlsSessionSettings.cs,1.4,1.5
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-09-12 12:47:15
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source In directory sc8-pr-cvs1:/tmp/cvs-serv7637 Modified Files: TlsSessionSettings.cs TlsSession.cs TlsReader.cs Log Message: Prepare for beta1 Index: TlsSessionSettings.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsSessionSettings.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsSessionSettings.cs 4 Sep 2003 12:37:04 -0000 1.4 --- TlsSessionSettings.cs 12 Sep 2003 12:47:11 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- private TlsProtocol protocol; private X509CertificateCollection certificates; + private bool useBufferedStreams; #endregion *************** *** 67,70 **** --- 68,77 ---- } + public bool UseBufferedStreams + { + get { return useBufferedStreams; } + set { useBufferedStreams = value; } + } + #endregion *************** *** 73,81 **** public TlsSessionSettings() { ! this.protocol = TlsProtocol.Tls1; ! this.certificates = new X509CertificateCollection(); ! this.serverName = "localhost"; ! this.serverPort = 443; ! this.encoding = Encoding.Default; } --- 80,89 ---- public TlsSessionSettings() { ! this.protocol = TlsProtocol.Tls1; ! this.certificates = new X509CertificateCollection(); ! this.serverName = "localhost"; ! this.serverPort = 443; ! this.encoding = Encoding.Default; ! this.useBufferedStreams = true; } Index: TlsSession.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsSession.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TlsSession.cs 4 Sep 2003 12:34:17 -0000 1.10 --- TlsSession.cs 12 Sep 2003 12:47:11 -0000 1.11 *************** *** 306,311 **** // Create the reader and the writer ! reader = new TlsReader(this, new BufferedStream(networkStream), settings.Encoding); ! writer = new TlsWriter(this, new BufferedStream(networkStream), settings.Encoding); } private void closeStreams() --- 306,319 ---- // Create the reader and the writer ! if (settings.UseBufferedStreams) ! { ! reader = new TlsReader(this, new BufferedStream(networkStream), settings.Encoding); ! writer = new TlsWriter(this, new BufferedStream(networkStream), settings.Encoding); ! } ! else ! { ! reader = new TlsReader(this, networkStream, settings.Encoding); ! writer = new TlsWriter(this, networkStream, settings.Encoding); ! } } private void closeStreams() Index: TlsReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsReader.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TlsReader.cs 2 Sep 2003 14:53:26 -0000 1.12 --- TlsReader.cs 12 Sep 2003 12:47:11 -0000 1.13 *************** *** 133,144 **** else { ! MemoryStream str = new MemoryStream(); while (session.NetworkStream.DataAvailable) { ! str.WriteByte(base.ReadByte()); } ! return str.ToArray(); } } --- 133,147 ---- else { ! MemoryStream ms = new MemoryStream(); + // This will wait until data is readed + byte b = base.ReadByte(); + ms.WriteByte(b); while (session.NetworkStream.DataAvailable) { ! ms.WriteByte(base.ReadByte()); } ! return ms.ToArray(); } } *************** *** 273,277 **** else { ! return base.ReadString(); } } --- 276,280 ---- else { ! return encoding.GetString(this.ReadBytes()); } } |