@@ -697,7 +697,7 @@ public void Connect()
697697 /// </remarks>
698698 public void Disconnect ( )
699699 {
700- DiagnosticAbstraction . Log ( string . Format ( "[{0}] {1} Disconnecting session" , ToHex ( SessionId ) , DateTime . Now . Ticks ) ) ;
700+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Disconnecting session. " , ToHex ( SessionId ) ) ) ;
701701
702702 // send SSH_MSG_DISCONNECT message, clear socket read buffer and dispose it
703703 Disconnect ( DisconnectReason . ByApplication , "Connection terminated by the client." ) ;
@@ -843,7 +843,7 @@ internal void SendMessage(Message message)
843843 WaitOnHandle ( _keyExchangeCompletedWaitHandle ) ;
844844 }
845845
846- DiagnosticAbstraction . Log ( string . Format ( "[{0}] SendMessage to server '{1}': '{2}'." , ToHex ( SessionId ) , message . GetType ( ) . Name , message ) ) ;
846+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Sending message '{1}' to server : '{2}'." , ToHex ( SessionId ) , message . GetType ( ) . Name , message ) ) ;
847847
848848 var paddingMultiplier = _clientCipher == null ? ( byte ) 8 : Math . Max ( ( byte ) 8 , _serverCipher . MinimumSize ) ;
849849 var packetData = message . GetPacket ( paddingMultiplier , _clientCompression ) ;
@@ -947,12 +947,12 @@ private bool TrySendMessage(Message message)
947947 }
948948 catch ( SshException ex )
949949 {
950- DiagnosticAbstraction . Log ( string . Format ( "Failure sending message server '{0}': '{1}' => {2}" , message . GetType ( ) . Name , message , ex ) ) ;
950+ DiagnosticAbstraction . Log ( string . Format ( "Failure sending message '{0}' to server : '{1}' => {2}" , message . GetType ( ) . Name , message , ex ) ) ;
951951 return false ;
952952 }
953953 catch ( SocketException ex )
954954 {
955- DiagnosticAbstraction . Log ( string . Format ( "Failure sending message server '{0}': '{1}' => {2}" , message . GetType ( ) . Name , message , ex ) ) ;
955+ DiagnosticAbstraction . Log ( string . Format ( "Failure sending message '{0}' to server : '{1}' => {2}" , message . GetType ( ) . Name , message , ex ) ) ;
956956 return false ;
957957 }
958958 }
@@ -998,16 +998,9 @@ private Message ReceiveMessage()
998998 return null ;
999999 }
10001000
1001- #if DEBUG_GERT
1002- DiagnosticAbstraction . Log ( string . Format ( "[{0}] FirstBlock [{1}]: {2}" , ToHex ( SessionId ) , blockSize , ToHex ( firstBlock ) ) ) ;
1003- #endif // DEBUG_GERT
1004-
10051001 if ( _serverCipher != null )
10061002 {
10071003 firstBlock = _serverCipher . Decrypt ( firstBlock ) ;
1008- #if DEBUG_GERT
1009- DiagnosticAbstraction . Log ( string . Format ( "[{0}] FirstBlock decrypted [{1}]: {2}" , ToHex ( SessionId ) , firstBlock . Length , ToHex ( firstBlock ) ) ) ;
1010- #endif // DEBUG_GERT
10111004 }
10121005
10131006 packetLength = ( uint ) ( firstBlock [ 0 ] << 24 | firstBlock [ 1 ] << 16 | firstBlock [ 2 ] << 8 | firstBlock [ 3 ] ) ;
@@ -1053,16 +1046,8 @@ private Message ReceiveMessage()
10531046 var numberOfBytesToDecrypt = data . Length - ( blockSize + inboundPacketSequenceLength + serverMacLength ) ;
10541047 if ( numberOfBytesToDecrypt > 0 )
10551048 {
1056- #if DEBUG_GERT
1057- DiagnosticAbstraction . Log ( string . Format ( "[{0}] NextBlocks [{1}]: {2}" , ToHex ( SessionId ) , bytesToRead , ToHex ( nextBlocks ) ) ) ;
1058- #endif // DEBUG_GERT
1059-
10601049 var decryptedData = _serverCipher . Decrypt ( data , blockSize + inboundPacketSequenceLength , numberOfBytesToDecrypt ) ;
10611050 Buffer . BlockCopy ( decryptedData , 0 , data , blockSize + inboundPacketSequenceLength , decryptedData . Length ) ;
1062-
1063- #if DEBUG_GERT
1064- DiagnosticAbstraction . Log ( string . Format ( "[{0}] NextBlocks decrypted [{1}]: {2}" , ToHex ( SessionId ) , decryptedData . Length , ToHex ( decryptedData ) ) ) ;
1065- #endif // DEBUG_GERT
10661051 }
10671052 }
10681053
@@ -1092,10 +1077,6 @@ private Message ReceiveMessage()
10921077 messagePayloadLength = data . Length ;
10931078 }
10941079
1095- #if DEBUG_GERT
1096- DiagnosticAbstraction . Log ( string . Format ( "[{0}] Message info (Sequence:{1},MessagePayloadLength:{2})" , ToHex ( SessionId ) , _inboundPacketSequence , messagePayloadLength ) ) ;
1097- #endif // DEBUG_GERT
1098-
10991080 _inboundPacketSequence ++ ;
11001081
11011082 return LoadMessage ( data , messagePayloadOffset , messagePayloadLength ) ;
@@ -1120,7 +1101,7 @@ private void TrySendDisconnect(DisconnectReason reasonCode, string message)
11201101 /// <param name="message"><see cref="DisconnectMessage"/> message.</param>
11211102 internal void OnDisconnectReceived ( DisconnectMessage message )
11221103 {
1123- DiagnosticAbstraction . Log ( string . Format ( "[{0}] {1} Disconnect received: {2 } {3} " , ToHex ( SessionId ) , DateTime . Now . Ticks , message . ReasonCode , message . Description ) ) ;
1104+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Disconnect received: {1 } {2}. " , ToHex ( SessionId ) , message . ReasonCode , message . Description ) ) ;
11241105
11251106 // transition to disconnecting state to avoid throwing exceptions while cleaning up, and to
11261107 // ensure any exceptions that are raised do not overwrite the SshConnectionException that we
@@ -1578,14 +1559,9 @@ private Message LoadMessage(byte[] data, int offset, int count)
15781559 var messageType = data [ offset ] ;
15791560
15801561 var message = _sshMessageFactory . Create ( messageType ) ;
1581-
1582- #if DEBUG_GERT
1583- DiagnosticAbstraction . Log ( string . Format ( "[{0}] Loading message with offset '{1}': {2}" , ToHex ( SessionId ) , offset , ToHex ( data , 0 ) ) ) ;
1584- #endif // DEBUG_GERT
1585-
15861562 message . Load ( data , offset + 1 , count - 1 ) ;
15871563
1588- DiagnosticAbstraction . Log ( string . Format ( "[{0}] ReceiveMessage from server: '{1}': '{2}'." , ToHex ( SessionId ) , message . GetType ( ) . Name , message ) ) ;
1564+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Received message '{1}' from server : '{2}'." , ToHex ( SessionId ) , message . GetType ( ) . Name , message ) ) ;
15891565
15901566 return message ;
15911567 }
@@ -1627,7 +1603,7 @@ private void SocketConnect(string host, int port)
16271603 var ipAddress = DnsAbstraction . GetHostAddresses ( host ) [ 0 ] ;
16281604 var ep = new IPEndPoint ( ipAddress , port ) ;
16291605
1630- DiagnosticAbstraction . Log ( string . Format ( "Initiating connect to '{0}:{1}'." , host , port ) ) ;
1606+ DiagnosticAbstraction . Log ( string . Format ( "Initiating connection to '{0}:{1}'." , host , port ) ) ;
16311607
16321608 _socket = SocketAbstraction . Connect ( ep , ConnectionInfo . Timeout ) ;
16331609
@@ -2209,7 +2185,7 @@ private void RaiseError(Exception exp)
22092185 {
22102186 var connectionException = exp as SshConnectionException ;
22112187
2212- DiagnosticAbstraction . Log ( string . Format ( "[{0}] {1} Raised exception: {2 }" , ToHex ( SessionId ) , DateTime . Now . Ticks , exp ) ) ;
2188+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Raised exception: {1 }" , ToHex ( SessionId ) , exp ) ) ;
22132189
22142190 if ( _isDisconnecting )
22152191 {
@@ -2234,7 +2210,7 @@ private void RaiseError(Exception exp)
22342210
22352211 if ( connectionException != null )
22362212 {
2237- DiagnosticAbstraction . Log ( string . Format ( "[{0}] {1} Disconnecting after exception: {2 }" , ToHex ( SessionId ) , DateTime . Now . Ticks , exp ) ) ;
2213+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Disconnecting after exception: {1 }" , ToHex ( SessionId ) , exp ) ) ;
22382214 Disconnect ( connectionException . DisconnectReason , exp . ToString ( ) ) ;
22392215 }
22402216 }
@@ -2290,7 +2266,7 @@ protected virtual void Dispose(bool disposing)
22902266
22912267 if ( disposing )
22922268 {
2293- DiagnosticAbstraction . Log ( string . Format ( "[{0}] Disposing session" , ToHex ( SessionId ) ) ) ;
2269+ DiagnosticAbstraction . Log ( string . Format ( "[{0}] Disposing session. " , ToHex ( SessionId ) ) ) ;
22942270
22952271 Disconnect ( ) ;
22962272
0 commit comments