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:
Winni Neessen 2024-11-22 14:58:41 +01:00
parent 45776c052f
commit f9e869061e
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -601,12 +601,16 @@ func (c *Client) SetLogAuthData() {
// SetDSNMailReturnOption sets the DSN mail return option for the Mail method
func (c *Client) SetDSNMailReturnOption(d string) {
c.mutex.Lock()
c.dsnmrtype = d
c.mutex.Unlock()
}
// SetDSNRcptNotifyOption sets the DSN recipient notify option for the Mail method
func (c *Client) SetDSNRcptNotifyOption(d string) {
c.mutex.Lock()
c.dsnrntype = d
c.mutex.Unlock()
}
// HasConnection checks if the client has an active connection.