Author: Jack Bailey Date: To: exim-users Subject: Re: [exim] Exim gets constantly the same mail,
sent from our customer (gagabay)
>>> We've been here before. If you can find a way to tell that the sender
>>> has gone away without trying to read from the input file descriptor, it
>>> would also solve the problem of "delay" hanging around when the other
>>> end has disappeared. We had a discussion about this about a year ago (?)
>>> and concluded that it was not possible.
>>>
>> Non-blocking read?
>>
>
> No good. You don't actually want to read the input if it is there.
>
>
>> Some other system call?
>>
>
> Nobody came up with anything when we discussed this before.
I took a look at this awhile back and it's possible to detect far end
disconnections by setting the socket to async IO. The idea is arrange
for Unix to send the process a signal when IO is pending on the socket,
but it also works for disconnects. It goes something like this:
flag = 1;
ioctl(sockfd, FIOASYNC, &flag);
flag = getpid();
setpgid(0, 0);
ioctl(sockfd, SIOCSPGRP, &flag);
I tested a hack similar to this with exim-4.66 on Solaris 10 and CentOS
4.4. Works great.