--- deliantra/server/socket/loop.C 2006/12/14 04:30:33 1.14 +++ deliantra/server/socket/loop.C 2006/12/14 21:46:34 1.15 @@ -277,53 +277,12 @@ } } - -/***************************************************************************** - * - * Low level socket looping - select calls and watchdog udp packet - * sending. - * - ******************************************************************************/ - -#ifdef WATCHDOG - -/** - * Tell watchdog that we are still alive - * - * I put the function here since we should hopefully already be getting - * all the needed include files for socket support - */ - -void -watchdog (void) -{ - static int fd = -1; - static struct sockaddr_in insock; - - if (fd == -1) - { - struct protoent *protoent; - - if ((protoent = getprotobyname ("udp")) == NULL || (fd = socket (PF_INET, SOCK_DGRAM, protoent->p_proto)) == -1) - { - return; - } - insock.sin_family = AF_INET; - insock.sin_port = htons ((unsigned short) 13325); - insock.sin_addr.s_addr = inet_addr ("127.0.0.1"); - } - sendto (fd, (void *) &fd, 1, 0, (struct sockaddr *) &insock, sizeof (insock)); -} -#endif - void flush_sockets (void) { - player *pl; - - for (pl = first_player; pl != NULL; pl = pl->next) - if (pl->socket->status != Ns_Dead) - Socket_Flush (pl->socket); + for (sockvec::iterator i = client_sockets.begin (); i != client_sockets.end (); ++i) + if ((*i)->status != Ns_Dead) + (*i)->flush (); } /** @@ -337,7 +296,7 @@ doeric_server (void) { int i, pollret; - fd_set tmp_read, tmp_write; + fd_set tmp_read; struct sockaddr_in addr; socklen_t addrlen = sizeof (struct sockaddr); player *pl, *next; @@ -375,7 +334,6 @@ } FD_ZERO (&tmp_read); - FD_ZERO (&tmp_write); for (sockvec::iterator i = client_sockets.begin (); i != client_sockets.end (); ) { @@ -392,9 +350,6 @@ FD_SET (s->fd, &tmp_read); - if (s->outputbuffer.len) - FD_SET (s->fd, &tmp_write); - ++i; } } @@ -405,7 +360,7 @@ timeout.tv_usec = 0; pollret = select (maxfd + 1, - &tmp_read, &tmp_write, 0, + &tmp_read, 0, 0, &timeout); if (pollret == -1) @@ -422,13 +377,6 @@ client_socket *s = *i; player *pl = s->pl; - //TODO: writing should be independent of tick - if (FD_ISSET (s->fd, &tmp_write)) - { - s->can_write = 1; - write_socket_buffer (s); - } - //TODO: disassociate handleclient from socket readin if (s->inbuf_len || FD_ISSET (s->fd, &tmp_read)) HandleClient (s, pl);