mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 14:10:50 +01:00
Add mutex locks to DSN option setters
Mutex locks are added to ensure thread safety when setting DSN mail return and recipient notify options. This prevents data races in concurrent environments, improving the client's robustness.
This commit is contained in:
parent
45776c052f
commit
f9e869061e
1 changed files with 4 additions and 0 deletions
|
@ -601,12 +601,16 @@ func (c *Client) SetLogAuthData() {
|
||||||
|
|
||||||
// SetDSNMailReturnOption sets the DSN mail return option for the Mail method
|
// SetDSNMailReturnOption sets the DSN mail return option for the Mail method
|
||||||
func (c *Client) SetDSNMailReturnOption(d string) {
|
func (c *Client) SetDSNMailReturnOption(d string) {
|
||||||
|
c.mutex.Lock()
|
||||||
c.dsnmrtype = d
|
c.dsnmrtype = d
|
||||||
|
c.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDSNRcptNotifyOption sets the DSN recipient notify option for the Mail method
|
// SetDSNRcptNotifyOption sets the DSN recipient notify option for the Mail method
|
||||||
func (c *Client) SetDSNRcptNotifyOption(d string) {
|
func (c *Client) SetDSNRcptNotifyOption(d string) {
|
||||||
|
c.mutex.Lock()
|
||||||
c.dsnrntype = d
|
c.dsnrntype = d
|
||||||
|
c.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasConnection checks if the client has an active connection.
|
// HasConnection checks if the client has an active connection.
|
||||||
|
|
Loading…
Reference in a new issue