12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net.Sockets;
- using SuperSocket.SocketBase;
- namespace SuperSocket.SocketEngine
- {
- abstract partial class SocketSession
- {
- private const string m_GeneralErrorMessage = "Unexpected error";
- private const string m_GeneralSocketErrorMessage = "Unexpected socket error: {0}";
-
-
-
-
- protected void LogError(Exception exception)
- {
- int socketErrorCode;
-
- if (IsIgnorableException(exception, out socketErrorCode))
- return;
- var message = socketErrorCode > 0 ? string.Format(m_GeneralSocketErrorMessage, socketErrorCode) : m_GeneralErrorMessage;
- AppSession.Logger.LogError(this, message, exception);
- }
-
-
-
-
-
- protected void LogError(string message, Exception exception)
- {
- int socketErrorCode;
-
- if (IsIgnorableException(exception, out socketErrorCode))
- return;
- AppSession.Logger.LogError(this, message, exception);
- }
-
-
-
-
- protected void LogError(int socketErrorCode)
- {
- if (!Config.LogAllSocketException)
- {
-
- if (IsIgnorableSocketError(socketErrorCode))
- return;
- }
- AppSession.Logger.LogError(this, string.Format(m_GeneralSocketErrorMessage, socketErrorCode), new SocketException(socketErrorCode));
- }
- }
- }
|