ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/metaserver.c
(Generate patch)

Comparing deliantra/server/socket/metaserver.c (file contents):
Revision 1.1.1.1 by root, Fri Feb 3 07:14:44 2006 UTC vs.
Revision 1.5 by root, Sun Jul 9 14:09:20 2006 UTC

1/* 1/*
2 * static char *rcsid_metaserver_c = 2 * static char *rcsid_metaserver_c =
3 * "$Id: metaserver.c,v 1.1.1.1 2006/02/03 07:14:44 root Exp $"; 3 * "$Id: metaserver.c,v 1.5 2006/07/09 14:09:20 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
118 * Updates our info in the metaserver 118 * Updates our info in the metaserver
119 */ 119 */
120void metaserver_update(void) 120void metaserver_update(void)
121{ 121{
122 char data[MAX_BUF], num_players=0; 122 char data[MAX_BUF], num_players=0;
123#define CAT2_SUXX
124#ifdef CAT2_SUXX
125 num_players += 20;
126#endif
123 player *pl; 127 player *pl;
124 128
125 if (metafd == -1) return; /* No valid connection */ 129 if (metafd == -1) return; /* No valid connection */
126 130
127 /* We could use socket_info.nconns, but that is not quite as accurate, 131 /* We could use socket_info.nconns, but that is not quite as accurate,
128 * as connections in the progress of being established, are listening 132 * as connections in the progress of being established, are listening
129 * but don't have a player, etc. This operation below should not be that 133 * but don't have a player, etc. This operation below should not be that
130 * costly. 134 * costly.
131 */ 135 */
132 for (pl=first_player; pl!=NULL; pl=pl->next) { 136 for (pl=first_player; pl!=NULL; pl=pl->next)
133 if (!pl->hidden) num_players++; 137 if (!pl->hidden pl->ob->map) num_players++;
134 }
135 138
136 sprintf(data,"%s|%d|%s|%s|%d|%d|%ld", settings.meta_host, num_players, VERSION, 139 sprintf(data,"%s|%d|%s|%s|%d|%d|%ld", settings.meta_host, num_players, VERSION "+",
137 settings.meta_comment, cst_tot.ibytes, cst_tot.obytes, 140 settings.meta_comment, cst_tot.ibytes, cst_tot.obytes,
138 (long)time(NULL) - cst_tot.time_start); 141 (long)time(NULL) - cst_tot.time_start);
139 if (sendto(metafd, data, strlen(data), 0, (struct sockaddr *)&sock, sizeof(sock))<0) { 142 if (sendto(metafd, data, strlen(data), 0, (struct sockaddr *)&sock, sizeof(sock))<0) {
140 LOG(llevDebug,"metaserver_update: sendto failed, err = %d\n", errno); 143 LOG(llevDebug,"metaserver_update: sendto failed, err = %d\n", errno);
141 } 144 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines