[Dnsmail-cvs] dnsmail/DnsMail DnsMail.cs,1.4,1.5
Brought to you by:
ethem
From: Ethem E. <et...@us...> - 2006-08-04 09:52:22
|
Update of /cvsroot/dnsmail/dnsmail/DnsMail In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv31716/dnsmail/DnsMail Modified Files: DnsMail.cs Log Message: Merged from DNSMAIL_02 Index: DnsMail.cs =================================================================== RCS file: /cvsroot/dnsmail/dnsmail/DnsMail/DnsMail.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DnsMail.cs 17 Jul 2006 12:55:29 -0000 1.4 --- DnsMail.cs 4 Aug 2006 09:52:19 -0000 1.5 *************** *** 33,37 **** #endregion ! #region Class Members private Socket m_Client; // Mail Client --- 33,37 ---- #endregion ! #region Class Members private Socket m_Client; // Mail Client *************** *** 157,173 **** { get ! { if (m_LocalPoint == null) ! { ! IPHostEntry iphostentry = Dns.GetHostByName(DNSAPI.LocalHost); ! foreach(IPAddress ip in iphostentry.AddressList) ! { ! if (! IPAddress.IsLoopback(ip)) ! { ! m_LocalPoint = new IPEndPoint(ip, 0); ! break; ! } ! } ! } return m_LocalPoint; } --- 157,164 ---- { get ! { if (m_LocalPoint == null) ! m_LocalPoint = new IPEndPoint(IPAddress.Any, 0); ! return m_LocalPoint; } *************** *** 788,835 **** private void sendbuffereddata(StringBuilder header) { ! byte[] buffer; int len; ! try { // :::::::::::::: Send Headers :::::::::::: buffer = m_Enc.GetBytes( header.ToString() ); ! header.Remove(0, header.Length); header = null; int sent = SocketWrite(buffer, buffer.Length); if (sent <= 0 || sent != buffer.Length) throw new Exception("Headers couldn't be sent!"); ! // ::::::::::::::::: Send Body ::::::::::::::::: ! if (mi.Body != null && (len=mi.Body.Length) > 0) { ! String body = mi.Body; ! char[] buffchar = new char[MaxBuffer]; ! int totalsent = 0, remain, tosend; ! bool finalbuffer = false; ! remain = len; ! do { ! if (remain > MaxBuffer) ! tosend = MaxBuffer; ! else ! { ! tosend = remain; ! finalbuffer = true; ! } ! body.CopyTo(totalsent, buffchar, 0, tosend); ! //qp encode ! buffer = MIME.QPEncode( ! m_Enc.GetBytes(buffchar, 0, tosend), ! finalbuffer ? SmtpEncode.All : SmtpEncode.Dot ! ); ! // send ! sent = SocketWrite(buffer, buffer.Length); ! if((sent<=0)||(sent!=buffer.Length)) break; ! totalsent += tosend; remain -= tosend; ! OnSendProgress(totalsent, remain); ! buffer = null; } - while( totalsent < len && m_Client.Connected); - Array.Clear(buffchar, 0, buffchar.Length); - body = null; buffchar = null; } len = sent = 0; } --- 779,838 ---- private void sendbuffereddata(StringBuilder header) { ! byte[] buffer; ! try { + int len, tosend; // :::::::::::::: Send Headers :::::::::::: buffer = m_Enc.GetBytes( header.ToString() ); ! header.Remove(0, header.Length); ! header = null; int sent = SocketWrite(buffer, buffer.Length); if (sent <= 0 || sent != buffer.Length) throw new Exception("Headers couldn't be sent!"); ! if (mi.Body == null || (len=mi.Body.Length) <= 0) ! goto Label_finish; ! ! int remain = len; ! int totalsent = 0; ! bool finalbuffer = false; ! ! String body = mi.Body; ! char[] buffchar = new char[MaxBuffer]; ! ! Label_loop: ! ! if (remain > MaxBuffer) ! tosend = MaxBuffer; ! else { ! tosend = remain; ! finalbuffer = true; ! } ! ! body.CopyTo(totalsent, buffchar, 0, tosend); ! //qp encode ! buffer = MIME.QPEncode( ! m_Enc.GetBytes(buffchar, 0, tosend), ! finalbuffer ? SmtpEncode.All : SmtpEncode.Dot ! ); ! // send ! sent = SocketWrite(buffer, buffer.Length); ! if ((sent > 0) && sent == buffer.Length) ! { ! totalsent += tosend; ! remain -= tosend; ! OnSendProgress(totalsent, remain); ! buffer = null; ! if ((totalsent < len) && m_Client.Connected) { ! goto Label_loop; } } + + body = null; + buffchar = null; + + Label_finish: len = sent = 0; } *************** *** 838,843 **** try { ! if (m_Client != null && m_Client.Connected && ! m_Client.Poll(TimeOut, SelectMode.SelectWrite)) SocketWrite(crlf_dot_crlf, crlf_dot_crlf.Length); } --- 841,845 ---- try { ! if (m_Client != null && m_Client.Connected && m_Client.Poll(TimeOut, SelectMode.SelectWrite)) SocketWrite(crlf_dot_crlf, crlf_dot_crlf.Length); } *************** *** 846,850 **** } } ! private byte[] recvBuffer; private Commands SendAndReceive(String val) --- 848,852 ---- } } ! private byte[] recvBuffer; private Commands SendAndReceive(String val) |