Relevant during shutdown. Make sure all late_port_release objects are
still appended to the global queue.
Change-Id: I8aa6c2a8ddabdf7296a6934e51ce420c5587ac53
The GLib slice allocator has been obsoleted. Having a mixture of two
allocators can lead to hidden issues on systems that use different
implementations. Take the leap and replace everything with g_new/g_free.
Change-Id: I025c8383ef47b2c2472573360407fd6a6ca339b3
Make the macro return the appropriate pointer type, and make sure the
free function takes an argument of the same type. This also eliminates
some boilerplate type-casting code.
Change-Id: I3094271fa2c53ec93b9ff9f837d461cf422e0f12
Revert of 128e84e and implement for io_uring poller
Turns out that this function is necessary to prevent out-of-order writes
to a streambuf once the connection is open.
Use a simple array to keep track of blocked fds under uring.
Change-Id: I4af2a64071030fd4892dde88547705230aec59fd
To support asynchronous pollers which may hold references on underlying
sockets, let the poller close the socket after it has released its
references. This prevents cases of file descriptor re-use while an
underlying socket is still open.
Add reset_socket() to be used in place of close_socket() which does the
same thing except the actual closing of the socket.
Add poller_del_item_callback() for cases where more action than just
closing the file descriptor is needed.
Change-Id: Iefda1487ecb89263729120ecb964436dd79b2a0e
The poller-per-thread feature was broken with a division by zero. Take
the opportunity to rework it and eliminate the poller_map object. Use a
simple array of pollers for media sockets, plus one global poller for
control sockets. In the regular case only one poller is created and
everything points to that poller. In the poller-per-thread case, one
poller per thread is created, plus one poller (also with its own single
thread) for control connections. All control sockets use the single
control poller, while all media sockets get assigned one poller from the
pool in a round-robin fashion.
closes#1801
Change-Id: Iae91a3e10b7206455c6df33b1a472254c700ce21
This is a dependency of the poller and so is needed in lib/ as well to
make it usable.
Also consolidate the type.
Change-Id: I70ec8a200d6cd65710ac93636a9495cf24c35ef4
All timers have been moved to their dedicated timer threads, making this
mechanism obsolete.
The only victim is the timeout handling for TCP control streams. Since
other TCP streams aren't using timeout handling either, and the TCP
control socket is barely used by anyone, we can live with not having a
dedicated timeout for these streams for now.
Change-Id: I83d9b9a844f4f494ad37b44f5d1312f272beff3f
This is useful for functions which are used both from a timer and from
other callers. These functions would reset the logging context at their
end to free the reference held by the logging context, which would
wrongly reset the logging context when the same function was called from
a different code path. Using a stack with push/pop semantics makes it
safe to use these functions from any code path.
Additionally introduce an explicit reset function that clears the entire
stack regardless of context. This reset function is called at the end of
every work iteration in every worker thread, just in case not everything
was popped from the stack.
Change-Id: I0e2c142b95806b26473c65a882737e39d161d24d
Instead of having each thread sleep only a little while and then
periodically check for the shutdown flag, make them sleep longer and use
pthread_cancel() to interrupt the sleep during a shutdown in the
designated break points.
Change-Id: I13f1872a0176697e064ceef4062db6ca6ccf7a0e
Whether a bit-field is signed or unsigned is implementation specific, so
we should be explicit about this.
Change-Id: I744df3d24bc08e95fa816ba4135f19cd3a5dcb17
Warned-by: lgtm
EPOLL_CTL_MOD is used to monitor an fd's writeable status when write was
blocked, but due to a race condition it's possible that the same fd gets
closed by another thread at the same time, causing the EPOLL_CTL_MOD to
fail. As this is now expected, handle it appropriately.
fixes#684
Change-Id: I1ddf16fdbf0fe3e98b4d908544735b823c4cf539
One thread may close an fd while another thread is processing the result
events that can include a POLLOUT for the same fd. That same fd might
then get re-opened as another type of object and get added to the poller
again. When the POLLOUT event then gets processed, no `writeable`
function would be present.
This is not a clean fix for the underlying race condition as stray
events might still get processed, but seeing extra stray events should
not be a problem.
Change-Id: I2fa2277bb0ddf512f53917297bd4220fe794dd0e
Squashed commit of the following:
commit 00213e66c7
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 27 09:40:04 2015 -0500
perform ICE restart if we change ports
commit 27fbcbd6cb
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 15:58:12 2015 -0500
locking fixes
commit 60c1c5ae13
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 15:58:06 2015 -0500
unkernelize when ICE completes
commit 1d816f9864
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 15:54:44 2015 -0500
relaxed locking where not needed
commit 75b58a9093
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 11:46:08 2015 -0500
use atomic bitfield instead of bitfield+mutex
commit 03552eeed9
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 11:24:59 2015 -0500
shuffle around aux.h a bit more
commit b9b8a3aa5e
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 11:16:12 2015 -0500
remove some code redundancy through a "state machine"
commit 0b4bfef1b1
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 10:10:41 2015 -0500
reorder to match struct
commit a2a51d81a8
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 10:10:03 2015 -0500
clear more states for ICE restart
commit d554a2b858
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 09:58:29 2015 -0500
dont duplicate candidates on re-invite
commit 4c804652b7
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 09:58:20 2015 -0500
retain ICE role across re-invites
commit 4a586dd72d
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 09:42:09 2015 -0500
eliminate duplicate log messages
commit ef0be2e308
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 26 09:32:36 2015 -0500
fix incorrect log message
commit 2544b60f00
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 15:26:48 2015 -0500
better logging for ICE agents
commit c42807384e
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 15:18:27 2015 -0500
dont run ICE checks if we dont have a password
commit 1b56cb75b5
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 15:16:19 2015 -0500
ICE pairs should go in triggered queue only once
commit d10c56f3ae
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 14:04:00 2015 -0500
obsolete the ICE agent running flag
commit 52237e3399
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 14:02:06 2015 -0500
cease checks once ICE is completed
commit 5332d18612
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 13:53:57 2015 -0500
fix ICE completion logging
commit 85f5fd63aa
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 13:53:33 2015 -0500
make better use of bit flags
commit 796b48bb78
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 12:09:46 2015 -0500
improved learned candidate pairing and completion logic
commit d15561072e
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 11:21:45 2015 -0500
support upper case transport strings
commit 557da7b1c3
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 10:43:57 2015 -0500
use struct endpoint in ice candidates
commit 951040bfd6
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 10:31:13 2015 -0500
more meaningful ICE log messages
commit 8ec2426bd3
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 09:54:49 2015 -0500
shut down agent if no components - limit number of candidates
commit 149260f3a6
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 25 09:44:13 2015 -0500
handle ICE restarts
commit 6a18c31f81
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 16:29:01 2015 -0500
dont clear succeeded flag when nominating
commit 93e0861d02
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 16:21:40 2015 -0500
use correct pwd in stun binding response
commit 32ba3ea406
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 16:03:09 2015 -0500
use deterministic foundation for prflx cands
commit 2f2dc91515
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 15:21:13 2015 -0500
handle initial ICE role
commit a6b8ad25e6
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 14:43:47 2015 -0500
another ICE scheduling fix
commit c572b04e55
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 14:14:29 2015 -0500
make ICE aware of rtcp-mux
commit 93cd2d2560
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 14:13:27 2015 -0500
print timestamp when logging to stderr
commit 22a52ffda2
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 14:13:13 2015 -0500
ICE scheduling fixes
commit 5d2d1a7739
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 13:27:59 2015 -0500
increase ICE pwd length to make chrome happy
commit ceff6698db
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 13:09:54 2015 -0500
dont discard RTP if ICE hasnt finished yet
commit e809877d0e
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 13:06:31 2015 -0500
implement remote-candidates (untested)
commit 41670eadbb
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 11:58:13 2015 -0500
shut down ICE agent when everything fails
commit 1ca26c4a81
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 11:10:46 2015 -0500
fix up SDP output for ICE candidates
commit 0287d68f33
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 10:09:49 2015 -0500
process ICE completion and fire up DTLS if desired
commit 5b6386036b
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 09:37:52 2015 -0500
use a btree to schedule ice checks
commit 2bc25f1e0f
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 24 09:37:02 2015 -0500
convert shutdown condition into global var
commit ecf0c5587c
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 14:50:46 2015 -0500
replace poller_now with timeval g_now
commit 164ecdd7ac
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 13:00:15 2015 -0500
handle nominations if we're controlling
commit d013659365
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 12:11:40 2015 -0500
copy controlling/ed role into agent
commit 09f1cae14a
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 12:02:54 2015 -0500
separate nominated pairs from valid pairs
commit f75f338cde
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 11:55:30 2015 -0500
organize aux.h into sections
commit d6acee1392
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Mon Feb 23 11:55:17 2015 -0500
use b-tree for various ICE lists
commit af9804d139
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 16:21:09 2015 -0500
prepare to finalize ice processing
commit 18df118375
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 16:19:50 2015 -0500
prettier logging
commit 280755c61a
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 15:02:14 2015 -0500
implement unfreezing of other components on success
commit 5d13657d5b
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 15:00:24 2015 -0500
bitfield access macros
commit 71746ad6a1
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 14:15:05 2015 -0500
handle ice updates and duplicate candidates
commit 02309d1b5b
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 12:22:29 2015 -0500
handle role conflicts
commit 52acf54ba5
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 10:24:01 2015 -0500
proper pair priorities calculation
commit 307af79e8d
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 09:54:18 2015 -0500
fix address family mixups
commit 7cbfd4d36a
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 20 09:14:49 2015 -0500
delay dtls startup and timeout checks while ice is running
commit 2a8ab75228
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 19 16:47:56 2015 -0500
process ice/stun responses
commit 92da323dcf
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 19 15:14:30 2015 -0500
adding stun server script for testing
commit c5cfeb122c
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 19 13:42:40 2015 -0500
act on stun requests, learn prflx candidates
commit 1cafd35e7a
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 19 13:30:14 2015 -0500
fix pktinfo for ipv4 packets
commit 8e338b8426
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Thu Feb 19 11:48:55 2015 -0500
rework interface handling to prepare to learn ICE candidate
commit 09e365c142
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 18 16:24:42 2015 -0500
add some locking
commit 8fc7b75095
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 18 16:05:20 2015 -0500
extend logic in response to stun req and implement triggered checks
commit 35eeb04376
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 18 12:46:42 2015 -0500
handle ice/stun retransmits and timeouts
commit b5637565b6
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Wed Feb 18 11:19:19 2015 -0500
first implementation of sending ICE checks
commit f0c1928c05
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 17 14:39:11 2015 -0500
preliminary list and loop for ICE checks
commit c38d6e22c1
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue Feb 17 12:00:24 2015 -0500
pair up candidates and prepare to run checks
commit d9559b4c59
Author: Richard Fuchs <rfuchs@sipwise.com>
Date: Fri Feb 13 15:36:29 2015 -0500
parse and remeber basic ICE attributes