Commit graph

862 commits

Author SHA1 Message Date
Eric House
6cd3ebd780 improve logging 2013-07-02 18:31:02 -07:00
Eric House
0ac5d6d9e2 don't send more than three unanswered chats per boot -- to avoid
filling up the queues in a way that doesn't reflect real use.
2013-07-02 18:30:23 -07:00
Eric House
dd48cea912 don't log string before it's initialized 2013-07-02 07:26:32 -07:00
Eric House
9fca3792cf don't pile on chat messages when relay isn't even connected: it's an
unfair test that doesn't duplicate what users will likely do.
2013-07-02 05:53:58 -07:00
Eric House
9ceb1615b3 replace tabs with spaces 2013-06-30 17:24:33 -07:00
Eric House
070590b3c2 cleanup 2013-06-30 08:34:09 -07:00
Eric House
b506a91068 add commandline params 2013-06-30 08:33:58 -07:00
Eric House
195f873ab0 tweak logging 2013-06-30 07:37:35 -07:00
Eric House
6fbf2d4a8b use g_compute_checksum_for_data, removing self-written equivalent 2013-06-30 07:36:56 -07:00
Eric House
7efbfab0e5 fix crash in debug version: len of data to be summed needs to be 32 bits! 2013-06-30 06:50:57 -07:00
Eric House
1a73ab26ac tweak logging 2013-06-28 20:33:27 -07:00
Eric House
17eda4e5e1 move md5sum code into separate function that relay can copy 2013-06-28 20:33:12 -07:00
Eric House
6c756533e3 fix double-dispose crash (but there's still a memory leak) 2013-06-28 20:32:19 -07:00
Eric House
5c284fe6b0 test PID is live before killing it 2013-06-28 18:55:19 -07:00
Eric House
292982a4b4 when splitting packet, queue them and send on timer rather than
sleeping the main thread.
2013-06-27 07:00:36 -07:00
Eric House
0bb4f5b0f5 fix occasional memory leak 2013-06-26 00:41:16 -07:00
Eric House
8324b9c770 fix compile error by making HELP another command. 2013-06-26 00:39:58 -07:00
Eric House
7967966982 Merge remote-tracking branch 'origin/android_branch' into local_fix_relay
Conflicts:
	xwords4/linux/linuxmain.c
	xwords4/linux/main.h
2013-06-25 06:18:43 -07:00
Eric House
5612bb000b quick hack to allow testing intermix of chat with normal moves 2013-06-24 18:37:49 -07:00
Eric House
5842654418 fix pattern 2013-06-24 07:30:38 -07:00
Eric House
aca3a96b54 fix pattern so ended games are detected 2013-06-24 07:18:53 -07:00
Eric House
bc6922cb8b add option to split tcp packets to test whether relay can handle reassembly. 2013-06-24 06:33:06 -07:00
Eric House
5e22508ff7 kill existing xwords instances as part of --clean-start 2013-06-21 06:58:20 -07:00
Eric House
6446819466 use nice to give the relay a fighting chance 2013-06-21 05:41:23 -07:00
Eric House
5bec10048b add --clean-start option to speed testing 2013-06-20 06:45:51 -07:00
Eric House
5da4936e43 report unexpected received packet size as an error 2013-06-17 06:42:21 -07:00
Eric House
c8f584dad2 don't listen on stdin if it's been closed 2013-06-10 06:15:36 -07:00
Eric House
d41c1a4ca8 add new param so pending text can be drawn differently when it's not
the player's turn.
2013-05-30 07:17:13 -07:00
Eric House
72a78100b1 fix compile error in non-debug version 2013-05-27 16:18:11 -07:00
Eric House
ffa983db94 use pipe to quit from signal handler since calling g_main_loop_quit()
doesn't work with more recent glib versions (and has always been a bad idea)
2013-05-24 21:19:20 -07:00
Eric House
4d96b695e6 toward having commandline params show up as defaults in new game dialog 2013-05-10 07:19:32 -07:00
Eric House
79a212c985 don't put up dict change dialog (which blocks) unless names are
different.
2013-05-09 21:37:58 -07:00
Eric House
d74814a806 part of previous (merge) commit that got left out -- files not saved. 2013-05-09 06:33:19 -07:00
Eric House
7d8cddb31f Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/linux/gtkmain.c
	xwords4/linux/linuxmain.c
	xwords4/relay/xwrelay.cpp
2013-05-08 07:37:55 -07:00
Eric House
3e9bb1c6b9 fix leak: dispose struct before overwriting it 2013-05-08 06:38:52 -07:00
Eric House
66d42fe5f2 fix a couple of leaks 2013-05-07 07:07:10 -07:00
Eric House
5a026ffda3 merge android_wordlists (local branch) 2013-05-01 06:39:31 -07:00
Eric House
541fc546ab remove that bit from flags -- since we already do the right thing for it. 2013-04-20 19:46:35 -07:00
Eric House
e4f52c5678 add assert and comment explaining why non-utf-8-aware hack is safe. 2013-04-18 07:15:14 -07:00
Eric House
2873d08974 fix memory leak 2013-04-13 16:49:20 -07:00
Eric House
195e6bfad3 add option to dump an .xwd file, meant to replace dawg2dict.pl which
is becoming a pain to maintain.
2013-04-09 21:10:40 -07:00
Eric House
5912b76cb8 add option to dump an .xwd file, meant to replace dawg2dict.pl which
is becoming a pain to maintain.
2013-04-09 21:05:35 -07:00
Eric House
07cfdad699 fix to support synonyms within specials too -- for linux only so far.
Seems to work, though the dawg2dict.pl script is broken.
2013-04-09 07:43:04 -07:00
Eric House
3a628f4375 load new-format dict into linux client, display default faces
correctly, and search using alternate as well as default faces.  Next:
support for alternate specials.
2013-04-06 11:43:57 -07:00
Eric House
168ebeeb5b fix variable name misspelling 2013-02-22 21:10:46 -08:00
Eric House
c75ecef240 test deletion of games and generation of anonymous relayIDs 2013-01-29 07:42:10 -08:00
Eric House
72e100ccac use autoincrement primary key, same as on Android 2013-01-28 07:02:33 -08:00
Eric House
4b335ab464 make function static 2013-01-26 18:36:40 -08:00
Eric House
b324a382e2 I've seen read() return 0 after being told there's something on the
socket.  So in that case loop and try again five time -- in case the
docs are wrong that 0 means EOF?  Hmmm.
2013-01-26 11:58:48 -08:00
Eric House
88b20769f9 increase buffer size 2013-01-26 11:56:29 -08:00
Eric House
2aba3c0ce1 load dict early enough to have lang available to comms when it first connects. 2013-01-26 11:56:20 -08:00
Eric House
2e0ff09cf9 fix memory leak and uninstall idle proc on the way out 2013-01-24 21:10:41 -08:00
Eric House
498498a2bf remove gameToken param from XWPDEV_HAVEMSGS message since it's for the
whole device rather than one game on it.
2013-01-24 19:20:35 -08:00
Eric House
0fad19e38a make it possible to mix udp and non-udp games (which currently crashes the relay very rarely) 2013-01-24 18:56:10 -08:00
Eric House
481f344ff4 fix failure to clean up on exit 2013-01-24 08:08:53 -08:00
Eric House
cbb82eb5e8 add --via-udp option -- which causes app to crash because the memory
leak detector is working
2013-01-24 08:00:53 -08:00
Eric House
9f3250cb3f make curses version use udp socket when --db param passed. There's no
UI for the DB and the assumption is only one game will be stored but
this should let the test script be modified to test the new protocol.
2013-01-24 07:49:49 -08:00
Eric House
12f70154a0 changes for includes-messageID-please-ack protocol addition 2013-01-23 07:43:58 -08:00
Eric House
ae9ec31863 don't call g_main_loop_quit() from inside signal handler: it doesn't
work on Ubuntu LTS at least.  Instead write to a "quit pipe" and exit
the loop from the pipe's reader back outside exception context.
2013-01-21 18:57:48 -08:00
Eric House
e79b0bd3eb Merge branch 'gtk_multigame' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into gtk_multigame 2013-01-20 19:27:50 -08:00
Eric House
93ff4f4fcb handle the new length-plus-string format 2013-01-20 13:07:01 -08:00
Eric House
3fc31a6fe1 new enum for alert 2013-01-20 10:04:24 -08:00
Eric House
f06d129c24 change env variable name; provided inital board size and dict choices 2013-01-20 09:53:26 -08:00
Eric House
3dfb2e04e6 call comms_close in curses too to avoid new assert 2013-01-19 22:53:25 -08:00
Eric House
0ef3549a4e handle (display) the relay's new error message 2013-01-19 15:18:36 -08:00
Eric House
1bb9f9b1bf handle sending of messages generated by games opened only to receive
messages from relay.  And handle report that relayID is bad.
2013-01-19 14:37:49 -08:00
Eric House
1519a00004 toward being able to handle messages received for closed game.
Receipt seems to work but send in that state doesn't.
2013-01-18 07:49:00 -08:00
Eric House
4163309dae Let's have just one set of signal handlers 2013-01-17 06:37:53 -08:00
Eric House
2f772c56b2 make gtk app a better test bed: add db and row to window titles,
implement delete button and multiple selections, etc.
2013-01-16 21:16:07 -08:00
Eric House
c33c50ee6b add deleteGame() 2013-01-16 21:11:35 -08:00
Eric House
a6784464ff first set of networking changes testing per-device communication with
relay on behalf of a number of games.  Works as long as all the games
are open.
2013-01-16 06:46:33 -08:00
Eric House
a107365c88 change names of two types and variables of that type to make a common
pattern more sensible.  No code changes.
2013-01-15 19:04:20 -08:00
Eric House
dddb135b9d add more columns, and update each time game is saved 2013-01-09 06:30:52 -08:00
Eric House
fac3e6b678 fix gtk version to correctly implement util_setIsServer (which only
Android did so far) by calling server_initClientConnection().  Now
relay games work with both started as hosts.  (GTK UI prevents
starting one as a guest; cmdline is required for that, if it still
works.)
2013-01-08 07:28:30 -08:00
Eric House
5e2bfd20da add a checkbox -- which apparently won't interact until I "implement
the 'activate' virtual method".
2013-01-08 06:32:43 -08:00
Eric House
1cb959c86d type tree model column correctly 2013-01-07 20:51:59 -08:00
Eric House
76f3bb3413 fix curses version so discon_ok2 tests work again. 2013-01-07 20:40:46 -08:00
Eric House
565b742971 snapshot -- connects to relay but doesn't play yet. 2013-01-07 08:00:47 -08:00
Eric House
469e656464 track open games so don't double-open and can close all on quit 2013-01-07 06:36:34 -08:00
Eric House
f88387da80 lots of changes to separate game data from app data so several games
can be open at once.  (curses version is almost certainly broken)
2013-01-07 06:10:44 -08:00
Eric House
b61ed7b631 opening saved games and saving of changes now work. 2013-01-05 21:01:26 -08:00
Eric House
a8014a855b now games are displayed in lists. Next: open them. 2013-01-05 19:40:29 -08:00
Eric House
8238d45350 ignore the db 2013-01-05 19:37:05 -08:00
Eric House
e0dc83ed70 rest of what I just meant to commit. 2013-01-05 16:08:47 -08:00
Eric House
4af30c534c snapshot. New game button works and game gets saved in DB. Next: display and open from DB. 2013-01-05 16:08:19 -08:00
Eric House
63487dc5d0 assert gdk setup going ok 2013-01-03 08:18:35 -08:00
Eric House
ad2b925a60 print wordlist name as part of error message 2012-12-29 07:47:44 -08:00
Eric House
9598ea3585 fix to compile post API change. 2012-11-13 21:32:42 -08:00
Eric House
c4df31892e Fix occasional infinite loop of devices sending and receiving the same
message over and over when getting updated by GCM.  The problem
occurred when one device had an un-ACKable initial message still in
its queue.  I call resendAll a lot, which caused that message to get
resent to the other game which then replied without being able to ACK
it so it remained to be sent again.  This would continue until users
moved forward in the game.  The fix is to add a backoff timer to
resendAll() so that it can't loop.  The timer is reset when an ackable
and new message is received, meaning there's been a change in what's
available to resend.  And since users calling resendAll manually
expect it to do something, add a force param that ignores the backoff.
seems to fix the problem (but needs a lot of testing.)
2012-11-13 21:25:03 -08:00
Eric House
093fc4d1fa cleanup 2012-11-13 07:23:07 -08:00
Eric House
2908802017 try to make linux client mimic Android a bit better in saving after
any network activity so messages get acked more quickly.
2012-11-13 06:15:36 -08:00
Eric House
6ca966f22a make test script and linux client mimic case where relay regid is
rejected by relay.  Client re-registers and a new relay regid is
issued.
2012-11-12 07:27:20 -08:00
Eric House
1316ae4b67 Fix relay devid protocol to deal with case where client submits a
ID_TYPE_RELAY id that's not in the devices table (as has happened when
a device switches relay URLs during testing, but might also happen if
I have to delete an entry from the devices table.)  In that case,
return ID_TYPE_NONE to the client, which will be its clue to delete
its ID_TYPE_RELAY id and submit the platform-specific id again.

Note: android won't compile this revision thanks to util.h change
2012-11-10 15:05:44 -08:00
Eric House
b53412d98d Fix to actually work. Grrr. 2012-11-10 14:52:10 -08:00
Eric House
b0f85e02df use grep of app's help message to determine whether a param is
supported so can test with older clients and not crash.
2012-11-09 06:55:38 -08:00
Eric House
03108f311a Merge branch 'android_branch' into android_gcm 2012-11-05 06:14:21 -08:00
Eric House
59937b8514 modify how devids are handled on the relay and the protocol through
which they're communicated to the device.  Device is expected to have
a platform-specific notion of ID which the relay stores in a new
devices table and indexes with a 32-bit number which is returned to
the device -- which is encouraged but not required to use it in lieu
of the longer ID in future communications.  Modify linux client and
test script to use the relay-supplied id.  Some of this is commented
out for now.
2012-11-03 10:58:01 -07:00
Eric House
563422de02 turn on DEVID feature for linux 2012-11-02 05:35:56 -07:00
Eric House
3469975d2a add, still disabled by compile-time flags, code to transmit device ID
(e.g. ID Android devices get via GCM) to relay and to associate it
there with messages that need to be delivered.
2012-10-30 07:01:47 -07:00
Eric House
4ea8569abc honor --min-devs flag 2012-10-27 08:15:07 -07:00
Eric House
b097e0825e fix linux crash do to casting problem 2012-10-26 06:49:15 -07:00
Eric House
aec03fc572 When a game's consumated and guest discovers it isn't using the same
dict, give chance to switch, and to download if required.  Because of
the way the JNI thread works, and JNI's requirement in general that
env instances match up (e.g. dicts must be destroyed in the same
thread that creates them), substituting into a live game is too hard.
So the game's saved with its new dict and then reloaded.
2012-10-24 07:17:21 -07:00
Eric House
13c74cfbd5 protect changeDict feature with compile-time flags (since it can't be
used on Android)
2012-10-24 06:46:54 -07:00
Eric House
c69dbda36f add new game_changeDict() and enough gtk code to test it. 2012-10-23 19:06:00 -07:00
Eric House
4cf595e939 on commandline, only allow assignment of per-player dicts to local
players.  I don't know what happens when a player's position is
changed when its game is a guest and the hosts rearranges players.
Which is why on Android I'm moving to allowing per-player dicts only
on local-only games.
2012-10-14 19:10:42 -07:00
Eric House
25a1ee451b resolve links if required to get the actual name of the dict 2012-10-12 20:50:34 -07:00
Eric House
e90c5ee94f pass index of resigning player into util_notifyGameOver. Not yet
passed into java.
2012-10-09 05:31:12 -07:00
Eric House
e64ecfb78d implement resign on top of existing endGame logic, adding "quitter" as
new param passed to remote and changing final score formatting and
menu items to match.  Still need to show old menu on android in case
where game has already ended.
2012-10-07 12:47:06 -07:00
Eric House
4e0c7923d9 fix bug with clean target introduced when BUILD_DIR was introduced 2012-10-07 12:14:47 -07:00
Eric House
968340f665 Fix release-build warnings that new compiler flags. 2012-10-07 11:43:50 -07:00
Eric House
fd9b9f85e2 make util_hiliteCell conditional, and remove from android where it
wasn't used anyway.
2012-10-05 18:51:32 -07:00
Eric House
6ddd4a61c1 fix compile errors (mostly unused variables) found by gcc on latest
Ubuntu (12.04).
2012-09-25 07:28:02 -07:00
Eric House
53774eb807 Merge remote-tracking branch 'origin/android_branch' into android_branch 2012-09-24 20:08:14 -07:00
Eric House
140c982d41 merge from android_branch 2012-09-24 07:39:44 -07:00
Eric House
bdc114dc46 add phony targets to check, on debian-based systems, whether required
packages are installed and to install them.
2012-09-24 07:26:37 -07:00
Eric House
4fa5c61e14 add option to build in a separate directory, for e.g. case where source files
are on ro filesystem.
2012-09-17 06:48:53 -07:00
Eric House
a6bed2706d include, commented out, the parameter that makes things fall apart. I
think the protocol needs work to survive devices failing to save
state.  Better to work on making sure they always save.
2012-09-11 20:45:03 -07:00
Eric House
761f93dd7e use new mem_stream_make_sized 2012-09-11 19:07:00 -07:00
Eric House
75474e1891 Add option to pretend save failed a random pct of time. Point it to
test fix for problem on Android, but right now turning this on breaks
networking.
2012-09-11 07:26:17 -07:00
Eric House
ad4231289f fix --max-devs and resigns begin allowed when only one game 2012-09-11 07:24:51 -07:00
Eric House
0ccc2331b5 address bug where message was getting ACK'd by a device that failed to
save what it had ACK'd leaving the game permanently broken.  Do that
by adding a new method game_saveSucceeded() called after the client
claims to have committed bytes returned by game_writeToStream() to
disk.  In that method comms updates the value it'll use in subseqent
ACKs.
2012-09-10 07:31:45 -07:00
Eric House
1608f0a8f9 handle missing error messages 2012-09-09 15:49:17 -07:00
Eric House
9340db36c1 disallow opening android DBs when not configured correctly. 2012-09-09 15:48:57 -07:00
Eric House
8fbc9ca343 fix to compile in release mode 2012-09-09 09:22:00 -07:00
Eric House
95a7b14a3a transmit dict's md5sum along with name in initial message from host to
guest.  On guest, pass that sum into client code along with names so
the appropriate tests can be done and corrections taken.
2012-09-08 20:23:48 -07:00
Eric House
9a72f252ed Merge branch 'android_branch' into android_dictname 2012-09-08 13:20:59 -07:00
Eric House
14a77ff7f1 factor out common code 2012-09-08 07:45:18 -07:00
Eric House
5fa9b60846 add md5Sum field to dict struct, and on linux load it if present,
otherwise calculate it.  In DEBUG builds always calculate and assert
they match.
2012-09-07 20:34:06 -07:00
Eric House
270a19f3aa Revert "first of a set of changes to communicate to clients dictionary being"
This reverts commit b7a0f1489b, which I didn't mean to check in on this branch.
2012-09-03 21:34:51 -07:00
Eric House
ea4d805d5f first of a set of changes to communicate to clients dictionary being
used by server.  Clients need to care if e.g. the server's disallowing
phonies based on its dict.  Can only be sent if client is of latest
version.  In that case, common code calls into new util function.  In
future changes, BoardActivity's implemention of the callback will need
to check if the server's choice of dict is available, and if not offer
to download it.  Once it's available, will want to install it.
2012-09-03 21:33:46 -07:00
Eric House
b7a0f1489b first of a set of changes to communicate to clients dictionary being
used by server.  Clients need to care if e.g. the server's disallowing
phonies based on its dict.  Can only be sent if client is of latest
version.  In that case, common code calls into new util function.  In
future changes, BoardActivity's implemention of the callback will need
to check if the server's choice of dict is available, and if not offer
to download it.  Once it's available, will want to install it.
2012-09-03 21:29:21 -07:00
Eric House
4cb848582e fix edge cases in prefix matching 2012-08-28 07:35:11 -07:00
Eric House
145317426d Fix prefix matching to accept letters constituting the first part of a
digraph tile when at the end of a prefix so that e.g. GORIL in Catalan
will list GORIL·LA (rather than nothing since GORIL, ending with the L
tile, is not a prefix.)
2012-08-27 21:50:09 -07:00
Eric House
79be03ac66 splite lines to get under 80 columns; no code change 2012-08-27 07:06:40 -07:00
Eric House
9d174601b9 add field, and getter, for new dict header description string, and
load it in linux client.
2012-08-26 20:58:28 -07:00
Eric House
b29df8512a add null-terminated note to dawg header and modify linux client to
accept it if present.  Android client will successfully ignore it and
will need to be modified to capture and display it if present.  Idea's
to display information about copyright, source, etc. of wordlists.
2012-08-25 10:20:52 -07:00
Eric House
a86ab69aec don't store argv element in game data structure where it gets freed. 2012-08-22 07:35:18 -07:00
Eric House
13d359cb39 turn on endgame BONUSALL feature for linux client too 2012-08-13 06:44:46 -07:00
Eric House
c98bbe2b9a use setsockopt to limit read() block time and so to prevent linux
version from being unkillable when relay crashes at the wrong time.
2012-08-13 06:44:16 -07:00
Eric House
c49408d7e9 fix warnings compiling in release mode 2012-08-12 19:37:47 -07:00
Eric House
ec0702d584 initialize buffer that common code will pass to strcat. 2012-08-10 21:31:01 -07:00
Eric House
464696566d get rid of NODE_CAN_4. Not change to post-compiled code 2012-08-01 20:29:15 -07:00
Eric House
d25916ae5f protect sqlite code with compile-time flag so easier to disable. 2012-07-29 08:37:08 -07:00
Eric House
08e5fbdcc2 add ability to open game in sqlite3 DB from an Android phone. It's
read-only now: changes are not saved.  But it works!
2012-07-26 20:44:33 -07:00
Eric House
0c030360bf fix compile warning 2012-07-26 20:42:25 -07:00
Eric House
9b0436d1ee Make rem string measure function return boolean to indicate rect will
be invisible rather than setting width and height to 0.  No real
change beyond simplifying/speeding platform code.
2012-07-15 09:30:27 -07:00
Eric House
bd70a1dd7d improve text in remaining tiles dialog, and always show the tiles for
all trays rather than excluding those in current player's tray.
2012-07-09 21:44:29 -07:00
Eric House
f1c5ebeb31 don't hide REM tiles square when drops to 0 2012-07-09 21:43:35 -07:00
Eric House
d234646fb2 fix broken compile 2012-07-09 21:17:01 -07:00
Eric House
b9b58bd0a5 enable tray tap undo 2012-06-29 06:52:49 -07:00