Clean up a comment noticed by Jonathan Shao@Panasas.com and remove an
[Samba/gebeck_regimport.git] / source3 / wrepld / socket.c
blob3d759f0ab895446b2b1c653bfdd43b437640e54e
1 /*
2 Unix SMB/CIFS implementation.
3 process incoming packets - main loop
4 Copyright (C) Jean François Micouleau 1998-2002.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "includes.h"
22 #include "wins_repl.h"
24 fd_set *listen_set = NULL;
25 int listen_number = 0;
26 int *sock_array = NULL;
28 /*******************************************************************
29 Add an fd from the sock_array
30 ******************************************************************/
31 void add_fd_to_sock_array(int fd)
33 int *temp_sock=NULL;
35 temp_sock=(int *)Realloc(sock_array, (listen_number+1)*sizeof(int));
36 if (temp_sock==NULL)
37 return;
39 sock_array=temp_sock;
40 sock_array[listen_number]=fd;
41 listen_number++;
45 /*******************************************************************
46 Remove an fd from the sock_array
47 ******************************************************************/
48 void remove_fd_from_sock_array(int fd)
50 int i,j;
52 for (i=0; sock_array[i]!=fd && i<listen_number; i++)
55 if (i==listen_number) {
56 DEBUG(0,("remove_fd_from_sock_array: unknown fd: %d\n", fd));
57 return;
60 if (i==listen_number-1) {
61 sock_array=(int *)Realloc(sock_array, --listen_number*sizeof(int));
62 return;
65 for (j=i; j<listen_number-1; j++)
66 sock_array[j]=sock_array[j+1];
68 sock_array=(int *)Realloc(sock_array, --listen_number*sizeof(int));