Really?
This commit is contained in:
parent
83f4fbde7f
commit
3523f1cf4e
1 changed files with 5 additions and 7 deletions
|
@ -31,6 +31,7 @@ import (
|
||||||
type SMTPSession struct {
|
type SMTPSession struct {
|
||||||
connection net.Conn
|
connection net.Conn
|
||||||
host string
|
host string
|
||||||
|
buffer [4096]byte
|
||||||
|
|
||||||
ReversePathBuffer *string
|
ReversePathBuffer *string
|
||||||
ForwardPathBuffer []string
|
ForwardPathBuffer []string
|
||||||
|
@ -38,10 +39,8 @@ type SMTPSession struct {
|
||||||
|
|
||||||
func MakeSMTPSession(connection net.Conn, host string) SMTPSession {
|
func MakeSMTPSession(connection net.Conn, host string) SMTPSession {
|
||||||
return SMTPSession{
|
return SMTPSession{
|
||||||
connection,
|
connection: connection,
|
||||||
host,
|
host: host,
|
||||||
nil,
|
|
||||||
[]string{},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,15 +102,14 @@ func (self *SMTPSession) TraceSession(direction string, message string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var buffer = [1024]byte{}
|
|
||||||
func (self *SMTPSession) Read(delimiter string) (string, error) {
|
func (self *SMTPSession) Read(delimiter string) (string, error) {
|
||||||
var message string
|
var message string
|
||||||
for !strings.Contains(message, delimiter) {
|
for !strings.Contains(message, delimiter) {
|
||||||
num_read, err := self.connection.Read(buffer[:])
|
num_read, err := self.connection.Read(self.buffer[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
message += string(buffer[:num_read])
|
message += string(self.buffer[:num_read])
|
||||||
}
|
}
|
||||||
self.TraceSession(" ->", message)
|
self.TraceSession(" ->", message)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue