Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2002 16:23:37 -0400
From:      "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>
To:        dev@porting.openoffice.org, Martin Blapp <mb@imp.ch>
Cc:        <openoffice@freebsd.org>
Subject:   Re: [porting-dev] FreeBSD and webdav problems
Message-ID:  <200208151623.37127.kevin.hendricks@sympatico.ca>
In-Reply-To: <20020815171253.Y17516-100000@levais.imp.ch>
References:  <20020815171253.Y17516-100000@levais.imp.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

The question I have here is why this socket is set to be non-blocking.  Is 
this something port specific for FreeBSD?  Where is the f cntl done on the 
socket fd that makes it non-blocking?

If not non-blocking, then connect should block and wait and not return 
EINPROGRESS.

I can not find any code that sets things up to be non-blocking (perhaps 
that is a default under FreeBSD?) or I missed it someplace.

Kevin

On August 15, 2002 11:22, Martin Blapp wrote:
> Hi all,
>
> I see some strange behaviour here with webdav. A connection
> does loop here: external/neon/rtufiles/socket.c
>
> nsocket *sock_connect(const struct in_addr addr,
>                       unsigned short int portnum)
> {
>     struct sockaddr_in sa;
>     int fd;
>
>     /* Create the socket */
>     fd = socket(AF_INET, SOCK_STREAM, 0);
>     if (fd < 0)
>         return NULL;
>     /* Connect the nsocket */
>     sa.sin_family = AF_INET;
>     sa.sin_port = htons(portnum); /* host -> net byte orders */
>     sa.sin_addr = addr;
>     if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in))
> < 0) { (void) NEON_CLOSE(fd);
>         return NULL;
>     }
>     /* Success - return the nsocket */
>     return create_sock(fd);
> }
>
> Breakpoint 1, sock_connect (addr={s_addr = 80}, portnum=80) at
> socket.c:703 703         fd = socket(AF_INET, SOCK_STREAM, 0);
> (gdb) c
> Continuing.
>
> Breakpoint 4, 0x28bc0d4d in connect () from /usr/lib/libc_r.so.4
> (gdb) c
> Continuing.
>
> Breakpoint 3, sock_close (sock=0x81db870) at socket.c:872
> 872         ret = NEON_CLOSE(sock->fd);
> (gdb) c
> Continuing.
>
> Breakpoint 1, sock_connect (addr={s_addr = 80}, portnum=80) at
> socket.c:703 703         fd = socket(AF_INET, SOCK_STREAM, 0);
> (gdb) c
> Continuing.
>
> Breakpoint 4, 0x28bc0d4d in connect () from /usr/lib/libc_r.so.4
>
> (gdb) p errno
> $11 = 36
>
> connect() returns EINPROGRESS.
>
> [EINPROGRESS]      The socket is non-blocking and the connection cannot
>                    be completed immediately.  It is possible to
> select(2) for completion by selecting the socket for writing.
>
> This is not handled by the webdav code and so we get into
> and endless loop.
>
> How does this work on other platforms ?
>
> Martin
>
> Martin Blapp, <mb@imp.ch> <mbr@FreeBSD.org>
> ------------------------------------------------------------------
> ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
> Phone: +41 061 826 93 00: +41 61 826 93 01
> PGP: <finger -l mbr@freebsd.org>
> PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
> ------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@porting.openoffice.org
> For additional commands, e-mail: dev-help@porting.openoffice.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-openoffice" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208151623.37127.kevin.hendricks>