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 {
|
||||
connection net.Conn
|
||||
host string
|
||||
buffer [4096]byte
|
||||
|
||||
ReversePathBuffer *string
|
||||
ForwardPathBuffer []string
|
||||
|
@ -38,10 +39,8 @@ type SMTPSession struct {
|
|||
|
||||
func MakeSMTPSession(connection net.Conn, host string) SMTPSession {
|
||||
return SMTPSession{
|
||||
connection,
|
||||
host,
|
||||
nil,
|
||||
[]string{},
|
||||
connection: connection,
|
||||
host: host,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,15 +102,14 @@ func (self *SMTPSession) TraceSession(direction string, message string) {
|
|||
|
||||
}
|
||||
|
||||
var buffer = [1024]byte{}
|
||||
func (self *SMTPSession) Read(delimiter string) (string, error) {
|
||||
var message string
|
||||
for !strings.Contains(message, delimiter) {
|
||||
num_read, err := self.connection.Read(buffer[:])
|
||||
num_read, err := self.connection.Read(self.buffer[:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
message += string(buffer[:num_read])
|
||||
message += string(self.buffer[:num_read])
|
||||
}
|
||||
self.TraceSession(" ->", message)
|
||||
|
||||
|
|
Loading…
Reference in a new issue