Commit graph

12 commits

Author SHA1 Message Date
Eric House
811c8f535e add socket refcounting
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.)
2017-12-07 07:18:09 -08:00
Eric House
d5c4ecabce rename class; add some logging
Rename class that's no longer just about UDP as it began. Add a bit of
logging. This commit *should* not change behavior at all.
2017-12-03 19:18:36 -08:00
Eric House
d468866a01 no more variables called socket; all are "sock" now. 2015-11-20 23:15:04 -08:00
Eric House
d9bfc01e35 change unsigned char to uint8_t (using sed) 2013-08-29 22:55:11 -07:00
Eric House
13550865ad drop packets in queue if they've been there longer than 30 seconds --
which should be a configurable value.
2013-07-22 06:05:24 -07:00
Eric House
2da26cf8a9 cleanup/comment 2013-07-01 07:52:02 -07:00
Eric House
519f90a69a go with non-blocking sockets for tcp connections, adding the ability
to reassemble packets that arrive in separate recv() calls.
2013-06-24 07:09:57 -07:00
Eric House
b1ef09625e pair delete[] with new[] 2013-06-21 07:25:41 -07:00
Eric House
2a35fac1e8 rather than invalidating socket in AddrRec when it's closed, add a
timestamp set when it's opened.  Older copies with the same socket can
be tested against the cannonical copy maintained by tpool and sending
avoided when the timestamp shows the endpoint has likely changed.
Change tpool's list of sockets to a map for faster lookup, and get rid
of similar structure in udpqueue.
2013-06-21 06:05:26 -07:00
Eric House
46bd4d0047 inval tcp sockets in return addresses of packets waiting processing
when they're closed to prevent attempting to write replies to the
wrong device should the socket be reopened.
2013-06-20 07:07:56 -07:00
Eric House
a546c025d5 Rather than queuing sockets needing reading, read them immediately and
queue the packets for processing.  Add ids so they can be tracked in
the logs.  In addition to making tcp and udp packet processing more
similar this fixes the case where a read is delayed until after the
client has closed the connection (and so returns an error.)
2013-06-17 07:25:25 -07:00
Eric House
6a1b86380e add missing files from gtk_multigame branch -- to fix broken compile 2013-02-04 21:33:35 -08:00