Commit graph

40 commits

Author SHA1 Message Date
e6ce36df64 Spelling corrections
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-07 10:08:31 +02:00
afe5001a23 Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-07 09:38:32 +02:00
bae3f5447e Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-07-02 17:45:44 +02:00
b14f5276ab Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-28 16:21:34 +01:00
bb467c335d Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:33:48 +01:00
df4925d696 Update copyright notice 2013-01-12 17:45:01 +01:00
1118f1c0ca Update copyright notice 2012-06-10 10:52:22 +02:00
a1003ea7da io_shutdown() is now unused, remove 2012-04-26 19:57:19 +02:00
7a3cbf037a Add deadline support to io_output(), io_output_if_queue_long()
Replace parameter wait by deadline.  Non-zero wait argument becomes
(time_t)-1 argument, zero wait argument becomes zero deadline
argument.  No functional change, yet.
2012-04-26 19:43:22 +02:00
ddbcce12c3 Switch io_close(), io_input() from timeouts to deadlines
All users want deadlines.  Move the conversion from deadline to
timeout from callers to io.c, where it becoems an implementation
detail.
2012-03-31 19:03:19 +02:00
ed1cbc97e6 Base idle timeout on player->curup again, not current time
Idle timeout used to expire max_idle minutes after the last
player->curup update.  When we got rid of the idle thread in commit
08b94556 (v4.3.20), this got changed to "wait no more than max_idle
minutes for input".  Time spent computing and time spent blocked on
output no longer counts.  In particular, a connection can block
indefinitely on output since then.  Let's fix that.

Start with basing the input timeout on player->curup again.  The
missing output timeout will be added shortly.

Aside: since status() updates player->curup, the idle timer gets reset
when the update aborts a command.  Left for another day.
2012-03-27 17:23:18 +02:00
a96b400da3 Replace the per-iop input_timeout by per-function timeouts
Commit 08b94556 (v4.3.20) added io_open() parameter input_timeout.  It
applies to io_input() and, since commit 904822e3, to io_close().  Add
timeout parameters to these functions instead.
2012-03-27 17:23:14 +02:00
ca7578f1b8 Fix idle timeout during execute
Timeout during execute gets handled just like an EOF cookie: end the
batch file, resume reading normal commands.  That's wrong, we need to
close the connection.

A real EOF is recorded in the player's connection's EOF indicator.
Let's use that for all "connection needs to be closed" conditions, so
they all work the same.  Create io_set_eof() to provide access.

Make recvclient() set the player connection's EOF indicator on
timeout.  This makes the timeout "stick".  Record receipt of an EOF
cookie in new struct player member got_ctld.  Also abort the command,
as before.  This leaves further interpretation of the EOF cookie to
the command loops.

Make player_main() set the player connection's EOF indicator on
got_ctld.  Player connection gets closed on on EOF cookie, as before.

Change execute() to break the batch command loop when got_ctld is set,
then reset it.  Ends the batch file on EOF cookie, as before.

Change status() back to checking EOF and error indicators (partial
revert of commit 9c5854c8, v4.3.16), and drop struct player member
eof.
2012-02-21 18:10:52 +01:00
98cd2a3a70 Update known contributors comments 2011-04-14 20:21:23 +02:00
7e2008e7f4 License upgrade to GPL version 3 or later
Why upgrade?  I'm not a lawyer, but here's my take on the differences
to version 2:

* Software patents: better protection against abuse of patents to
  prevent users from exercising the rights under the GPL.  I doubt
  we'll get hit with a patent suit, but it's a good move just on
  general principles.

* License compatibility: compatible with more free licenses, i.e. can
  "steal" more free software for use in Empire.  I don't expect to steal
  much, but it's nice to have the option.

* Definition of "source code": modernization of some details for today's
  networked world, to make it easier to distribute the software.  Not
  really relevant to us now, as we normally distribute full source code.

* Tivoization: this is about putting GPL-licensed software in hardware,
  then make the hardware refuse to run modified software.  "Neat" trick
  to effectively deny its users their rights under the GPL.  Abuse was
  "pioneered" by TiVo (popular digital video recorders).  GPLv3 forbids
  it.  Unlikely to become a problem for us.

* Internationalization: more careful wording, to harden the license
  outside the US.  The lawyers tell us it better be done that way.

* License violations: friendlier way to deal with license violations.
  This has come out of past experience enforcing the GPL.

* Additional permissions: Probably not relevant to us.

Also include myself in the list of principal authors.
2011-04-12 21:20:58 +02:00
25d29c8f8f Convert tab after #define to space 2010-06-20 18:38:54 +02:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
c528fcbe3e Update known contributors comments 2009-12-13 17:34:28 +01:00
1b4496253d Move queue flush out of io.c
Player threads may only sleep under certain conditions.  In
particular, they must not sleep while a command is being aborted by
the update or shutdown.

io.c should not know about that.  Yet io_output_all() does, because it
needs to give up when update or shutdown interrupt it.  The function
was introduced in Empire 2, but it didn't give up then.  Fixed in
commit a7fa7dee, v4.2.22.  The fix dragged unwanted knowledge of
command abortion into io.c.

To clean up this mess, io_output_all() has to go.

First user is io_write().  io_write() automatically flushes the queue.
In wait-mode, it calls io_output_all() when the queue is longer than
the bufsize, to attempt flushing the queue completely.  In
no-wait-mode, it calls io_output() every bufsize bytes.  Except the
test for that is screwy, so it actually misses some of the flush
conditions.

The automatic flush makes io_write() differ from io_gets(), which is
ugly.  It wasn't present in BSD Empire 1.1.  Remove it again, dropping
io_write()'s last argument.

Flush the queue in its callers pr_player() and upr_player() instead.
Provide new io_output_if_queue_long() for them.  Requires new struct
iop member last_out to keep track of queue growth.  pr_player() and
upr_player() call repeatedly until it makes no more progress.  This
flushes a bit less eagerly in wait-mode, and a bit more eagerly in
non-wait mode.

Second user is recvclient().  It needs to flush the queue before
potentially sleeping in io_input().  Do that with a simple loop around
io_output().  No functional change there.
2009-07-19 14:11:53 -04:00
2e4f63c270 Remove IO_NOWAIT, IO_WAIT
They make the code slightly clearer in some places, and more
complicated in others.  Not worth it.
2009-07-19 14:11:52 -04:00
3805548b3e Remove blocking struct iop operation
The blocking I/O option makes no sense in the server, because it
blocks the server process instead of the thread.  In fact, it's been
unused since Empire 2, except for one place, where it was used
incorrectly, and got removed in the previous commit.

Make I/O non-blocking in io_open() unconditionally.  Remove IO_NBLOCK
and io_noblocking().
2009-07-19 14:11:52 -04:00
0025f24f1e Remove long defunct IO_NEWSOCK
Chainsaw used this together with the notify callback to make the iop
data type usable for sockets it listened on, so that io_select() could
multiplex them along with the sockets used for actual I/O.
io_select() became unused in Empire 2, and finally got removed in
commit 875d72a0, v4.2.13.  That made the IO_NEWSOCK and the notify
callback defunct.  The latter got removed in commit 7d5a6b81, v4.3.1.
2009-07-19 14:11:52 -04:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
Ron Koenderink
08b9455682 Reimplement max_idle without a separate thread
Remove the KillIdle thread.  Add timeout to struct iop, initialized in
io_open().  Obey it in io_input() by passing it to empth_select().  If
empth_select() times out, report that back through io_input() to
recvclient() and player_login().  If player_login() receives a timeout
indication, print a message and terminate the session.  If
recvclient() receives a timeout indication, flash a message to the
player and initiate a shut down the player's session.

Create WIN32 sys/time.h to define struct timeval.  This creates some
conflicts with WIN32 windows.h definitions.  Including windows.h in
show.c and info.c creates conflicts, so remove that.  Modify service.c
to include sys/socket.h instead of windows.h to remove the conflict
with sys/time.h.
2009-02-01 17:06:33 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +00:00
7d5a6b817e (iop): Remove unused members assoc, notify.
(io_open): Remove unused parameters assoc, notify.  Caller changed.
2006-03-29 19:19:47 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
fa52e6944d Normalize inclusion guards: use NAME_H for name.h. Some headers
lacked them, others used reserved identifiers.
2005-12-29 10:16:01 +00:00
0d267e0b24 There's no reason to include <time.h> in empio.h, except it's missing
in a couple of other files.  Include it where it's needed.
2005-12-28 21:25:39 +00:00
09b0b83971 (IO_CONN, io_conn, IOQ_BUFSIZE, MAXIOV, LND_NOTANY, plur)
(techfactfire, reltech, P_DISTING, PLN_MAXDEF, filetruncate, sct_init)
(nxtsctp, AN_SAILDIR, UDTIMES_MAX, BLITZTIME): Unused, remove.
2005-09-30 19:51:32 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
d12359938b (iop, iop_t): Unused, remove. 2004-04-08 19:53:17 +00:00
875d72a00f Garbage collection to side-step sparse file descriptor problem.
(io_select, io_flush, io_iopfromfd): Unused, remove.
(io_open): Allow more than one open for the same file descriptor.
The check is the last remaining use of io_list[], and it's
unimportant.
(io_list, niop, io_init): io_list[] no longer serves any purpose,
remove.  Sparse allocation of file descriptors (deplorable misfeature
of Winsock, at least some versions) is no longer a problem.
(getfdtablesize): Unused, remove.  Was broken for Windows anyway.
2004-02-06 12:35:51 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00