void ResumeInternalClose(LazyAsyncResult userResult)
{
GlobalLog.Print("ConnectStream##" + ValidationHelper.HashString(this) + "::ResumeInternalClose(), userResult:" + userResult);
//
// write stream. terminate our chunking if needed.
//
if (WriteChunked && !ErrorInStream && !m_IgnoreSocketErrors)
{
m_IgnoreSocketErrors = true;
try {
if (userResult == null)
{
SafeSetSocketTimeout(SocketShutdown.Send);
m_Connection.Write(NclConstants.ChunkTerminator, 0, NclConstants.ChunkTerminator.Length);
}
else
{
m_Connection.BeginWrite(NclConstants.ChunkTerminator, 0, NclConstants.ChunkTerminator.Length, new AsyncCallback(ResumeClose_Part2_Wrapper), userResult);
return;
}
}
catch (Exception exception) {
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::CloseInternal() exceptionOnWrite:" + exception.Message);
}
}
ResumeClose_Part2(userResult); //never throws
}