Replace the per-iop input_timeout by per-function timeouts
Commit08b94556
(v4.3.20) added io_open() parameter input_timeout. It applies to io_input() and, since commit904822e3
, to io_close(). Add timeout parameters to these functions instead.
This commit is contained in:
parent
0513ec136b
commit
a96b400da3
5 changed files with 32 additions and 29 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* Known contributors to this file:
|
||||
* Dave Pare, 1994
|
||||
* Markus Armbruster, 2005-2010
|
||||
* Markus Armbruster, 2005-2012
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -71,17 +71,14 @@ struct player *
|
|||
player_new(int s)
|
||||
{
|
||||
struct player *lp;
|
||||
struct timeval idle_timeout;
|
||||
|
||||
lp = malloc(sizeof(struct player));
|
||||
if (!lp)
|
||||
return NULL;
|
||||
memset(lp, 0, sizeof(struct player));
|
||||
idle_timeout.tv_sec = max_idle * 60;
|
||||
idle_timeout.tv_usec = 0;
|
||||
if (s >= 0) {
|
||||
/* real player, not dummy created by update and market update */
|
||||
lp->iop = io_open(s, IO_READ | IO_WRITE, IO_BUFSIZE, idle_timeout);
|
||||
lp->iop = io_open(s, IO_READ | IO_WRITE, IO_BUFSIZE);
|
||||
if (!lp->iop) {
|
||||
free(lp);
|
||||
return NULL;
|
||||
|
@ -98,11 +95,14 @@ player_new(int s)
|
|||
struct player *
|
||||
player_delete(struct player *lp)
|
||||
{
|
||||
struct timeval timeout;
|
||||
struct player *back;
|
||||
|
||||
if (lp->iop) {
|
||||
/* it's a real player */
|
||||
io_close(lp->iop);
|
||||
timeout.tv_sec = minutes(max_idle);
|
||||
timeout.tv_usec = 0;
|
||||
io_close(lp->iop, &timeout);
|
||||
lp->iop = NULL;
|
||||
}
|
||||
back = (struct player *)lp->queue.q_back;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue