From: Ying X. <yin...@wi...> - 2012-06-04 03:33:27
|
Erik Hugne wrote: > If an implied connect is attempted during link congestion, > the connect message will be discarded and sendmsg will return > EAGAIN. The application then need to retry the connection attempt > after congestion have abated. > This fixes a problem where polling on a socket in an > unconnected state always returned a zero mask. > > Signed-off-by: Erik Hugne <eri...@er...> > --- > net/tipc/socket.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/net/tipc/socket.c b/net/tipc/socket.c > index 03a2610..7710145 100644 > --- a/net/tipc/socket.c > +++ b/net/tipc/socket.c > @@ -407,7 +407,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr, > * socket state flags set > * ------------ --------- > * unconnected no read flags > - * no write flags > + * POLLOUT if port is not congested > * > * connecting POLLIN/POLLRDNORM if ACK/NACK in rx queue > * no write flags > @@ -437,6 +437,10 @@ static unsigned int poll(struct file *file, struct socket *sock, > poll_wait(file, sk_sleep(sk), wait); > > switch ((int)sock->state) { > + case SS_UNCONNECTED: > + if (!tipc_sk_port(sk)->congested) > + mask |= POLLOUT; > + break; > Maybe there has some potential issue, please see below scenario: 1. fd = socket(SOCK_STREAM)-->tipc_create() //sock->state = SS_UNCONNECTED 2. poll(fd) Each time the poll() is timed out, the POLLOUT event will be returned to poll() even if any message *doesn't* be sent via the socket. So please confirm the case. Thanks, Ying > case SS_READY: > case SS_CONNECTED: > if (!tipc_sk_port(sk)->congested) > |