[Freeciv-Dev] Re: mingw status (server + lan server bugs)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 25 Nov 2003, Andreas Røsdal wrote:
> On Tue, 25 Nov 2003, Vasco Alexandre Da Silva Costa wrote:
> > On Tue, 25 Nov 2003, Andreas Røsdal wrote:
> > > I think this is because the socket for UDP multicast is blocking,
> > > even though it's set to be nonblocking.
> > >
> > > This can be fixed by using select(), like it's done several
> > > places in /server/sernet.c. I can make a patch for this.
> >
> > UDP is connectionless. Make sure you aren't getting bogged down doing
> > a DNS name lookup.
>
> Ok. Here's the patch. The socket is not blocking any more,
> and if DNS lookup fail, then the IP is shown instead.
Eh no, you didn't understand. gethostbyname calls the resolver and I think
gethostbyaddr calls it too. To make sure you don't block in the resolver,
you need to use the integer address. You can convert a numbers and
dots address (e.g. 190.130.36.2) using inet_addr or inet_aton to integer
address format. That will not call the resolver.
Only use resolver calls to get the integer address from a DNS address
(e.g. freeciv.org).
You should find you do not need to use select at all since UDP is
connectionless.
Another thing, don't use OS macros if possible. The way to check for
things using autoconf is to detect features, not platforms. There should
be a macro defined, HAVE_SIZE_T or something... Yes, there is probably
crap like that somewhere else in the code, but please don't do it that
way.
---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa
- [Freeciv-Dev] mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/25
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Andreas Røsdal, 2003/11/25
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/25
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Vasco Alexandre Da Silva Costa, 2003/11/25
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/25
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Andreas Røsdal, 2003/11/26
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/26
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Andreas Røsdal, 2003/11/26
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/27
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Andreas Røsdal, 2003/11/27
- [Freeciv-Dev] Re: mingw status (server + lan server bugs), Per I. Mathisen, 2003/11/27
|
|