File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ type Client struct {
30
30
ext map [string ]string // supported extensions
31
31
localName string // the name to use in HELO/EHLO/LHLO
32
32
didHello bool // whether we've said HELO/EHLO/LHLO
33
+ didGreet bool // whether we've received greeting from server
33
34
helloError error // the error from the hello
34
35
rcpts []string // recipients accumulated for the current session
35
36
@@ -179,6 +180,10 @@ func (c *Client) Close() error {
179
180
}
180
181
181
182
func (c * Client ) greet () error {
183
+ if c .didGreet {
184
+ return nil
185
+ }
186
+
182
187
// Initial greeting timeout. RFC 5321 recommends 5 minutes.
183
188
c .conn .SetDeadline (time .Now ().Add (c .CommandTimeout ))
184
189
defer c .conn .SetDeadline (time.Time {})
@@ -189,6 +194,7 @@ func (c *Client) greet() error {
189
194
return err
190
195
}
191
196
197
+ c .didGreet = true
192
198
return nil
193
199
}
194
200
@@ -321,7 +327,8 @@ func (c *Client) startTLS(config *tls.Config) error {
321
327
testHookStartTLS (config )
322
328
}
323
329
c .setConn (tls .Client (c .conn , config ))
324
- return c .ehlo ()
330
+ c .didHello = false
331
+ return nil
325
332
}
326
333
327
334
// TLSConnectionState returns the client's TLS connection state.
Original file line number Diff line number Diff line change @@ -653,6 +653,10 @@ func TestTLSConnState(t *testing.T) {
653
653
return
654
654
}
655
655
defer c .Quit ()
656
+ if err := c .Hello ("localhost" ); err != nil {
657
+ t .Errorf ("Client hello: %v" , err )
658
+ return
659
+ }
656
660
cs , ok := c .TLSConnectionState ()
657
661
if ! ok {
658
662
t .Errorf ("TLSConnectionState returned ok == false; want true" )
You can’t perform that action at this time.
0 commit comments