Not sure why I was doing this, but it's not worth the
trouble (e.g. stopping updates of other data to fix an android bug
sending too many reregistration messages.) So now just use the first
element of arrays, replacing what's there instead of prepending. Ideally
those columns would not be arrays, but that's a harder change.
There's likely a bug in Android now where I'm registering over and
over though the fcm id hasn't been changed. That's wrong, but it's
also wrong (and filling up the db) to register a duplicate as if it
were new. So stop that.
My VSIZE is no longer legal, and apparently there's no workaround (no
way to safely figure the length of an array whose size is known at
compile time.) To avoid the risk of duplicating little constants, added
macros that define length in a way a new VSIZE can pick it up. Couldn't
make that work for struct field arrays, however, so there I'm using
constants.
Stuff I'm doing with invitation resends is making the relay loop
inifintely. Let's assert a small loop count instead: better to crash and
restart than loop forever unable to process requests.
AddrInfo now has ref()/unref() and keeps a global socket->refcount map
(since actual AddrInfo instances come and go.) When the
count drops to 0, the existing CloseSocket() method is called. This
seems to fix a bunch of race conditions that had a socket being closed
and reused while old code was still expecting to write to the device
attached to the socket the first time (along with lots of calls to close()
already-closed sockets, attempts to write() to closed sockets, etc.)
Use of mutex logging recurses infinitely if config uses mlock, so remove
that. And don't free sockets after handling their messages as they may
be in use elsewhere. This likely introduces a leak of sockets.
Haven't seen it happen, but I think there was a bug that could have led
to all the sockets coming back as ready from poll() being dropped. Fixed
that and added/cleaned up some logging.
When a device reconnects and there's no record for its
game (e.g. because an ISP's screwed up and the db and its host are
lost), recreate but keep the device's hid (position in the arrays
indicating mostly whether it's the inviter or invitee.) Tested by
running the linux scripts and deleting the games table mid-way
through, but not yet tested with android devices.
When Android client is backgrounded with a game playing (BoardActivity
on top) then brought to front again it fails to reconnect to relay
because it didn't disconnect and the relay thinks it's still there. The
right fix is in making the java code do the right thing (complete
disconnect), but it seems harmless to just honor the reconnect in this
case. Doesn't even cause leaks, per valgrind.
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
postgres is running (e.g. from a @reboot shortcut in a crontab) by
having it wait, sleeping periodically, until a connection is
available. Requires new flag be passed into main.