|
From: <cro...@li...> - 2003-03-24 08:03:50
|
Module Name: client
Committed By: mwedel
Date: Mon Mar 24 08:03:47 UTC 2003
Modified Files:
client: CHANGES
client/common: client.c
Log Message:
common/client.c: Add some usleeps() in negotiate_connection() - this reduces
cpu load when negotiating the connection (given 10 ms for data to actually
come in before checking for new data). Also, add a count and if we don't
get a response back from the server in the time frame, bail out.
MSW 2003-03-24
Start of context diffs
Index: client/CHANGES
diff -c client/CHANGES:1.98 client/CHANGES:1.99
*** client/CHANGES:1.98 Sun Mar 23 22:01:25 2003
--- client/CHANGES Mon Mar 24 00:03:45 2003
***************
*** 1,6 ****
! "$Id: CHANGES,v 1.98 2003/03/24 06:01:25 mwedel Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
configure.in, configure: checks added for alsa9 sound - update for cfsndserv.c
should come shortly.
--- 1,12 ----
! "$Id: CHANGES,v 1.99 2003/03/24 08:03:45 mwedel Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
+
+ common/client.c: Add some usleeps() in negotiate_connection() - this reduces
+ cpu load when negotiating the connection (given 10 ms for data to actually
+ come in before checking for new data). Also, add a count and if we don't
+ get a response back from the server in the time frame, bail out.
+ MSW 2003-03-24
configure.in, configure: checks added for alsa9 sound - update for cfsndserv.c
should come shortly.
Index: client/common/client.c
diff -c client/common/client.c:1.13 client/common/client.c:1.14
*** client/common/client.c:1.13 Sun Mar 23 22:01:28 2003
--- client/common/client.c Mon Mar 24 00:03:46 2003
***************
*** 1,6 ****
/*
* static char *rcsid_client_c =
! * "$Id: client.c,v 1.13 2003/03/24 06:01:28 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_client_c =
! * "$Id: client.c,v 1.14 2003/03/24 08:03:46 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 236,241 ****
--- 236,243 ----
void negotiate_connection(int sound)
{
+ int tries;
+
SendVersion(csocket);
/* We need to get the version command fairly early on because
***************
*** 245,253 ****
--- 247,265 ----
* However, if it doesn't send the version command, we have no idea
* what we are dealing with.
*/
+ tries=0;
while (csocket.cs_version==0) {
DoClient(&csocket);
if (csocket.fd == -1) return;
+
+ usleep(10*1000); /* 10 milliseconds */
+ tries++;
+ /* If we have't got a response in 10 seconds, bail out */
+ if (tries > 1000) {
+ close(csocket.fd);
+ csocket.fd=-1;
+ return;
+ }
}
if (csocket.sc_version<1023) {
***************
*** 330,335 ****
--- 342,354 ----
}
} /* Still have image_sums request to send */
} /* endif download all faces */
+
+ usleep(10*1000); /* 10 milliseconds */
+ /* Don't put in an upper time limit with tries like we did above - if the
+ * player is downloading all the images, the time this takes could be
+ * considerable.
+ */
+
} while (replyinfo_status != requestinfo_sent);
}
if (use_config[CONFIG_DOWNLOAD]) {
|