On Fri, 16 Apr 2021, post...@ptld.com wrote:
On 04-16-2021 1:04 pm, Wietse Venema wrote:
As Viktor noted, each smtpd(8) process makes its own connection to
a policy service. Then, an smtpd(8) process will reuse its own
policy service connection, not a connection that belongs to a
different smtpd(8) process.
Okay, if im understanding, the expected behavior is it is supposed to be one
new spawn for each client connection/event? So the answer im looking for is
my script should self terminate when it detects the client (postfix)
disconnect? Is that the expected behavior, there are no other clues given by
postfix to the policy server when it's no longer needed?
We presume that your listener, conceptually speaking, is spawning a thread
/ process for every new (source(address,port),dest(address,port)) tuple it
sees. Put that out of your mind. Logically we're in the context of a
/connection/, represented by that tuple. Within that connection multiple
commands could be sent, or not: don't hang up prematurely. However: they
might say "goodbye" or not. If the other end of the connection decides to
hang up, there should be some notification to your process and your read
should terminate with some special condition (read coming back empty,
"end of file" flag, ...) or exception; if that happens, assume they're not
coming back, no need to say "goodbye" yourself.
It's never a good idea to assume that the network is reliable. ;-)
(I'm sure you've double and triple-checked that you're not leaving
something unread or unwritten, and flushing all output buffers if that's
what it takes.)
--
Fred Morris