Commit graph

4484 commits

Author SHA1 Message Date
4bfb66a255 (empth_create): Adjust stack size to at least PTHREAD_STACK_MIN, not
PTHREAD_STACK_MIN + 1.
2005-07-23 17:50:31 +00:00
565faa8891 Cleanup, no functional change.
(empth_t, empth_sem_t): Define as incomplete types in empthread.h,
complete in pthread.c, to avoid exposing implementation details.

(EMPTH_KILLED): Move from empthread.h to pthread.c.
2005-07-23 17:40:49 +00:00
59c15ea9d4 [_DECTHREADS_] Drop support for DECthreads d4, a.k.a. DCE threads,
which are obsolete since at least 1997.

(empth_terminate, empth_wakeup) [__ppc__]: Ancient versions of OS X
lacked pthread_kill().  As a work-around, its use was disabled here
for all versions of OS X.  The work-around could lead to hangs.
Remove it and drop support for ancient versions of OS X.

(empth_create) [__linux__]: Linux has supported thread attribute
stacksize for ages.  Remove the special case.

(_MIT_POSIX_THREADS): Unused, remove.
2005-07-23 17:26:20 +00:00
bf61ce9f38 (empth_setctx): Unused, remove. 2005-07-23 16:55:31 +00:00
e15b7e2b9a (trade_desc, get_materials): Use i_type variable instead of int for
iterating over item types.
2005-07-23 16:53:06 +00:00
022685c47c (sell): Prompting for `amount' is confusing: is it the amount of goods
to offer or amount of money to ask for?.  Ask for `quantity' instead.
2005-07-23 16:50:43 +00:00
be1147e7f0 (bdes): Prompt was messed up when bmap contained designation 0. 2005-07-23 16:47:08 +00:00
8cc53c1c2b (status): Internal linkage. 2005-07-23 16:41:18 +00:00
Ron Koenderink
6484e52678 (stre): Fix to make it match what happens in attack sequence: land
units do not react to a mountain.

(stre): Add an empth_yield() per sector to make the server responsive
to other players as this command is CPU intensive.
2005-07-23 13:44:47 +00:00
Ron Koenderink
2a12333ecb (player_init) [_WIN32,__linux__ && __alpha__]: Remove the
SO_REUSEADDR socket option as it is not required for WIN32.
In WIN32, there is no waiting time when a port is closed before
it can be reused so SO_REUSEADDR is not required for WIN32.
Leave the option has a undesirable effect of allowing a second
server instance to start without an error and leaving both
instances running.  ALPHA and LINUX do support SO_REUSEADDR.
2005-07-23 13:43:35 +00:00
Ron Koenderink
db6fd8dad2 (player_main): Add empth_yield() in the command processing loop to ensure
after every command, other players gets a chance to execute a command.
This prevents denial of service attack that monopolizing the active server
thread by continuing feeding data to the server from a client.
2005-07-23 13:37:36 +00:00
Ron Koenderink
e332ff5fcc (launch_sat): Incorrectly assumed that plane_mob_max is 127 when
calculating when the satellite will be ready for use.
2005-07-18 23:52:30 +00:00
16e8d95c21 (melt_item_denom): i_type shift (include/item.h 1.12) broke
initializer, screwing up fallout damage.
2005-07-13 17:33:39 +00:00
4d25aa9f03 (pln_equip): Fix the previous rev. 2005-07-09 13:59:01 +00:00
f7b444721b (mission_pln_equip, pln_equip): Fix the previous rev. 2005-07-09 13:32:54 +00:00
c7a372c782 Doc fix. 2005-07-09 11:09:34 +00:00
Ron Koenderink
c0d009758c (show_sect_capab, mission_pln_equip, pln_equip): Change i_type
references to use I_NONE instead of zero.  Zero has been invalid since
item.h rev. 1.12, and was questionable style before.
2005-07-07 21:57:15 +00:00
Marc Olzheim
c6262a209c Update for src/lib/subs/pr.c:1.25 2005-07-06 09:14:20 +00:00
Ron Koenderink
42a3ce3958 (pr_player, upr_player): Blocking I/O on another player's struct iop *
is unsafe!  By the time the blocked thread wakes up, that player may
be gone, along with its struct iop *, and io_write() follows a
dangling pointer.  Moreover, at most one thread may use empth_select()
on the same file descriptor.  Violations of that restriction cause
threads to hang under Windows since ntthread.c rev. 1.15.  Make all
output to another player non-blocking for now.  Historically, player
threads sent output only to their socket, though their own iop.  This
was broken by flash and asynchronous telegram notification a long time
ago.
2005-07-04 14:07:31 +00:00
Ron Koenderink
4ea137e887 (empth_init) [_WIN32]: Change flags to global_flags to prevent
scope conflict with the parameter flags.
2005-07-02 14:06:10 +00:00
744d118768 Document Windows lossage and work-around. 2005-07-01 19:52:43 +00:00
8e8ffb483c (loc_GVAR): Putting file local variables into a struct serves no
useful purpose whatsoever.  Peel off the struct.
2005-06-30 19:53:03 +00:00
Ron Koenderink
dfe767e7e0 (main) [_WIN32]: Windows putchar() screws up when printing multibyte
strings bytewise unless the stream is buffered.  Switch stdout to
line-buffered mode.
(login): Explicitly flush stdout, because Windows doesn't implement
line-buffering faithfully.
2005-06-30 16:10:42 +00:00
b239d6e3b1 (loc_Thread, loc_Sem_t): Remove typedef, use the typedef name defined
in the header instead.

Remove some superflous casts.
2005-06-30 14:25:30 +00:00
Ron Koenderink
ec5a8b31ba (loc_Sem_t, empth_sem_t) [_WIN32]: empthread.h defines empth_sem_t as
incomplete type struct loc_Sem_t.  Instead of completing it here, the
code defined an unrelated type loc_Sem_t as (complete) type struct
empth_sem_t.  The resulting type errors were swept under the carpet
with casts.  Obvious fix.
2005-06-26 18:31:14 +00:00
bf83673bb5 (deliver): Do not deliver friendly civilians into occupied sectors. 2005-06-26 13:32:15 +00:00
124ce4a398 (io_write): Use IO_NOWAIT rather than 0. No functional change. 2005-06-25 17:24:13 +00:00
6147446fc1 New doc & doc fixes. Remove s_char on the way.
(C_MOD): Turn into enumeration constant.
2005-06-25 17:22:45 +00:00
Ron Koenderink
8d284c5b4a (empth_sleep) [_WIN32]: If the sleep returns early, go back to sleep.
Short sleeps can cause double-updates and other trouble.

[_WIN32] (loc_SleepThisThread): Not used, removed.
2005-06-25 16:49:20 +00:00
f519de81d6 (create_pidfile): Silence compiler warning on printing pid_t with %d. 2005-06-25 16:41:34 +00:00
060df4ec8f Document Empire's thread abstraction. Minor cleanups:
(empth_init): Change first parameter to void **.
(empth_sleep): Change parameter to time_t.
2005-06-25 16:37:59 +00:00
dc21bc6d7d Doc clarification. 2005-06-23 19:21:34 +00:00
0d57181966 Remove some dead, disabled code. 2005-06-23 19:21:18 +00:00
78e880a608 (att_move_in_off): When boarding from a sector, mil entering the ship
less one were not removed from the sector.  The problem is putsect()
overwriting data from prior put_combat() with old data.  Broken in
rev. 1.17.  Change lunchbox code to match that of 1.16.  Closes
#1219918, reported by Doug Wescott.
2005-06-18 16:52:17 +00:00
Marc Olzheim
e6a7d4a694 Update for src/util/fairland.c:1.25 and include/prototypes.h:1.84 2005-06-15 12:55:21 +00:00
Marc Olzheim
e1ecf7bd86 Update patch for pr.c:1.22 2005-06-15 12:47:51 +00:00
a38ffacc37 (copy_ascii_no_funny, copy_utf8_no_funny)
(copy_utf8_to_ascii_no_funny): Don't consider newline funny.  This
fixes output filtering broken in rev. 1.17.
2005-06-14 05:01:26 +00:00
2f847f874d Document use of UTF-8. 2005-06-13 19:07:00 +00:00
65b6eaeee5 (player_login): Replace pr_player() by equivalent pr_id().
(pr_player, upr_player): Internal linkage.

(pr_hilite): Unused, remove.
2005-06-13 19:05:37 +00:00
71e164ed30 Document, in particular use of UTF-8. Simplify code in a couple of
places, but no functional changes.
2005-06-13 19:02:49 +00:00
9046ff0ad2 (outid): Fix recovery from bad argument N. Simplify. 2005-06-13 18:48:54 +00:00
1bf1b5b303 (uprnf): A print function must not change its text argument! 2005-06-13 18:28:10 +00:00
b5ff7e3beb (copy_ascii_no_funny, copy_utf8_no_funny)
(copy_utf8_to_ascii_no_funny): New.
(flash, wall, prmptrd, uprmptrd, getcommand): Use them to filter
input.
(uprnf, pr_flash): Use them to filter output.
(prtoascii): No longer used, remove.

(player_commands, player_commands_index): Internal linkage.
2005-06-13 18:16:44 +00:00
7e186ed7a8 (upr_player): A print function must not change its text argument! 2005-06-13 17:27:38 +00:00
968e754447 (lrange, shoo, execute): Buffer passed to getstarg() was too small.
Player could overrun it!
2005-06-13 11:32:07 +00:00
58a0d40777 (player_login, player_main): Move the C_INIT that terminates the login
phase to player_login().  No functional change.
(showvers): Trivial, used just once.  Inline, remove.
2005-06-13 09:45:32 +00:00
ac671d25e4 (parse): Support 127 arguments instead of 100, to match
player->argp[].  Assign complete argument vector.  This should make
buffer overruns blatantly obvious.

(parse): Don't bother checking SPACE argument, just crash.  It is
extremely unlikely that such a programming error wouldn't be
discovered by even them most superficial testing.
2005-06-13 09:33:54 +00:00
9ee7a02be8 (emp_config): Buffers passed to parse() were too small. econfig file
could overrun them.  Closes #899546.
2005-06-13 09:18:14 +00:00
2f35354097 (dispatch): Argument buf is user text and must be printed as such. In
error messages, print just the command name instead.
2005-06-13 08:57:39 +00:00
ddfd5c1699 (play_list): player->combuf[] is user text and must be printed as
such.
(ufindbreak, ufindpfx): Rename, move to pr.c, external linkage.
2005-06-13 08:42:27 +00:00