@@ -53,6 +53,11 @@ func NewPostfixAdapter(client UserliService) *PostfixAdapter {
5353// It fetches the destinations for the given alias.
5454// The response is a comma separated list of destinations.
5555func (p * PostfixAdapter ) AliasHandler (conn net.Conn ) {
56+ defer func () {
57+ if err := conn .Close (); err != nil {
58+ log .WithError (err ).Error ("Error closing connection" )
59+ }
60+ }()
5661 now := time .Now ()
5762
5863 payload , err := p .payload (conn )
@@ -80,6 +85,11 @@ func (p *PostfixAdapter) AliasHandler(conn net.Conn) {
8085// It checks if the domain exists.
8186// The response is a single line with the status code.
8287func (p * PostfixAdapter ) DomainHandler (conn net.Conn ) {
88+ defer func () {
89+ if err := conn .Close (); err != nil {
90+ log .WithError (err ).Error ("Error closing connection" )
91+ }
92+ }()
8393 now := time .Now ()
8494
8595 payload , err := p .payload (conn )
@@ -108,6 +118,11 @@ func (p *PostfixAdapter) DomainHandler(conn net.Conn) {
108118// It checks if the mailbox exists.
109119// The response is a single line with the status code.
110120func (p * PostfixAdapter ) MailboxHandler (conn net.Conn ) {
121+ defer func () {
122+ if err := conn .Close (); err != nil {
123+ log .WithError (err ).Error ("Error closing connection" )
124+ }
125+ }()
111126 now := time .Now ()
112127
113128 payload , err := p .payload (conn )
@@ -136,6 +151,11 @@ func (p *PostfixAdapter) MailboxHandler(conn net.Conn) {
136151// It fetches the senders for the given email.
137152// The response is a comma separated list of senders.
138153func (p * PostfixAdapter ) SendersHandler (conn net.Conn ) {
154+ defer func () {
155+ if err := conn .Close (); err != nil {
156+ log .WithError (err ).Error ("Error closing connection" )
157+ }
158+ }()
139159 now := time .Now ()
140160
141161 payload , err := p .payload (conn )
0 commit comments