Re: Re[2]: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection

From: kuznet(at)ms2(dot)inr(dot)ac(dot)ru
To: dyp(at)perchine(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, alan(at)lxorguk(dot)ukuu(dot)org(dot)uk, pgsql-hackers(at)postgresql(dot)org, davem(at)redhat(dot)com
Subject: Re: Re[2]: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection
Date: 2000-07-05 18:00:52
Message-ID: 200007051800.WAA11991@ms2.inr.ac.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

> I blamed that: Linux gives you EPIPE when you call recv before all
> data available is retrieved. If you will try to read AFTER error you
> will get all data. Problem is that it makes handling very complicated.
> In the case of EPIPE you should try to read again. The problem is that
> you should always try only once.

Well, to me it does not look very essential, when asynchronous
error returned. Remember about EAGAIN and EINTR yet. You are not confused
with such erros, right? Why? 8)

Seems, this order of issuing errors etc. at read() is specified in posix.
I do not know really. I have said, error reporting only if no data are pending,
looks legal and has its merits. Main thing is not to forget to report error
at all. 8)

[ Alan, seems, all the comments about order of checks while read()
are your ones. Can you comment? Maybe, it is really worth to change.
]

Side note: TLI really does not _allow_ any operations on endpoint
in any direction until asynchronous error condition is cleared.
In fact, Linux does this on BSD sockets as well.
This is really natural, but I agree, it is inconvenient yet.

Alexey

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2000-07-05 18:01:54 Re: Article on MySQL vs. Postgres
Previous Message Tom Lane 2000-07-05 17:50:42 Re: Re[2]: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection