Commit Graph

53 Commits

Author SHA1 Message Date
Michael Davidsaver b95b57945b cleanup clang-y static analysis
Some performance improvements.  eg. pass by ref.

Some paranoia pre-initialization of variables
which will be initialized later by indirection.

And some misc. cleanup.
2023-06-12 19:55:03 -07:00
Michael Davidsaver 20e0fa8ca5 client: re-define the meaning of poke() 2023-04-17 15:54:29 -05:00
Thomas Ives 07713faff4 fix: schedule initial search use separate event from the generic work queue
By using `tcp_loop.dispatch` to schedule the initial search for a
channel, we are placing the callback into the same work queue that is
used by e.g. `MonitorBuilder::exec` to schedule the call to
`Channel::build`.  In situations where lots of channels are being
created simultaneously this can result in lots of single channel search
requests being sent because the work queue alternates between calls to
build a channel and the initial search.

In this commit we instead use a dedicated `evevent` to schedule the
initial search to allow the `initialSearchBucket` to be filled before we
send the initial search request. We delay the initial search by 10 ms to
give more time for the bucket to be filled.  See
github.com/mdavidsaver/pvxs/pull/39 for a discussion of how this delay
was chosen.
2023-04-14 10:14:30 -07:00
Thomas Ives 7ae659678f fix: do not re-search for other channels when doing initial channel search
When creating a large number of Channels at once, we can end up calling
`ContextImpl::poke(true)` many times in quick succession.  This results
in a flood of UDP broadcasts where we are searching for channels that we
only just sent out the initial search request for.

This can easily lead to packets getting lost and us not receiving a
reply for some Channels.  Moreover, as we keep resending search requests
for Channels, we reschedule them further and further in the future (as
`nSearch` is increased).  After the dust settles and we stop poking,
this can result in a wait of several seconds before a Channel which we
have not found is searched for again.

In this commit we avoid this issue by using a separate bucket to hold
channels waiting for their initial search request.  Rather than poking
`tickSearch` to do the initial search and also resend requests for
outstanding channels, we schedule a call to new call `tickSearch` which
will only send the initial search requests.  As such, we will avoid
rebroadcasting search requests for channels we have only just searched
for.

We have prompted the `discover` bool to an enum to distinguish between
the now three different situations `tickSearch` can be called in.
2023-04-14 10:14:30 -07:00
Michael Davidsaver 0fdfeb72d1 Add testudpfwd 2023-04-10 08:47:15 -07:00
Michael Davidsaver 6f770d0ea3 final-ize some derived types 2023-03-20 09:41:41 -07:00
Michael Davidsaver 4141775c71 client: add non-intrusive free-list for subscription queue 2022-11-27 08:20:13 -08:00
Michael Davidsaver 0de17036f4 add Context::close() 2022-11-27 08:20:13 -08:00
Michael Davidsaver 0eea8fd1c7 fix CMD_MESSAGE handling 2022-10-14 10:20:51 -07:00
Michael Davidsaver 92f728f5c9 Add hold-off timer when reconnecting to a specific server 2022-06-19 10:51:45 -07:00
Michael Davidsaver 3f3e39418c Limit beaconTrack by size as well as time 2022-06-15 18:12:18 -07:00
Michael Davidsaver 0ad81d0f49 add Discovered::peerVersion 2022-05-18 12:27:33 -07:00
Michael Davidsaver 1be0477ee6 evsocket::canIPv6 once 2022-04-05 07:57:16 -07:00
Michael Davidsaver df4289b4e6 IPv6+mcast support 2022-04-05 07:57:16 -07:00
Michael Davidsaver 7a65a85c99 client: add discover() and pvxlist 2022-04-05 07:57:16 -07:00
Michael Davidsaver c503eece31 spell check 2021-08-13 15:18:31 -07:00
Michael Davidsaver f52609a587 client: ignoreGUIDs() 2021-07-06 18:32:52 -07:00
Michael Davidsaver f7b3821e10 client: consistent Channel disconnect handling
More commonality betwee disconnect and CMD_DESTROY_CHANNEL.

squash! client: consistent Channel disconnect handling

Periodic cache cleaning
2021-07-06 18:32:36 -07:00
Michael Davidsaver 5d3a21f030 client Channel search bypass
Bypass the broadcast search phase and directly connect
to a specific server and issue CMD_CREATE_CHANNEL.

Note, due to pvAccessCPP buggyness, this can only be relied
upon to connect with the unadvertised magic 'server' PV.
2021-07-03 13:20:20 -07:00
Michael Davidsaver bc1cc57f1e client: cacheClear() partial 2021-06-27 10:17:14 -07:00
Michael Davidsaver 8363c7fe9a client add TCP search 2021-06-27 10:17:14 -07:00
Michael Davidsaver 132ad1ae6f client: handle CMD_SEARCH_RESPONSE over TCP 2021-06-27 10:17:14 -07:00
Michael Davidsaver 708fbc8062 client: add *Builder::syncCancel(bool)
Option for asynchronous cancel (eg. implicitly through ~Operation).
2021-06-27 10:17:13 -07:00
Michael Davidsaver c4d2cd4a10 client: reorg context Pvt 2021-06-27 10:17:13 -07:00
Michael Davidsaver 8eac7c9941 client: relax exec() synchronization for connect() 2021-06-27 10:17:13 -07:00
Michael Davidsaver 60d275412f conn/chan tx/rx stat tracking 2021-06-27 10:17:13 -07:00
Michael Davidsaver 89f9c54d62 client: relax exec() synchronization
dispatch() instead of call().
2021-06-08 09:45:49 -07:00
Michael Davidsaver 564b9ec2cc client: add Context::connect()
A means of manually (pre)populating
the channel cache.
2021-06-08 09:45:49 -07:00
Michael Davidsaver bd7ba0db62 simplify GUID printing 2021-06-08 09:45:48 -07:00
Michael Davidsaver 94f0065a4d fix beaconSenders locking 2021-06-08 09:45:21 -07:00
Michael Davidsaver a064677e36 detect UDP RX buffer overflows
On Linux, use SO_RXQ_OVFL to snoop on the OS dropped packet
counter for our socket buffer.  Does not detect drops on
ingress, or internal to, to OS IP stack.
2021-01-28 07:44:32 -08:00
Michael Davidsaver d15430fb17 fix poke race
poke()d from both UDP (tickSearch()) and TCP workers (*Builder::exec())
2020-12-30 10:55:22 -08:00
Michael Davidsaver e52ae674ca client: bypass search throttling during Channel creation 2020-08-10 12:09:55 -07:00
Michael Davidsaver 3b9dd9c405 client Operation expose PV name
Desirable to include in error messages if nothing else
2020-08-10 12:09:55 -07:00
Michael Davidsaver 5079be41fe minor 2020-07-26 20:46:12 -07:00
Michael Davidsaver b6ee231ba8 ensure osiSockAttach() 2020-06-16 16:38:59 -07:00
Michael Davidsaver 609768a33d add client channel cache
Maintain unused channels for 20 seconds before closing.
2020-05-07 18:45:16 -07:00
Michael Davidsaver b0eecb949f fixup client operation object lifetime 2020-04-12 23:29:30 -07:00
Michael Davidsaver dd3706aa0f Avoid client Context leak
Keep no internal public Context refs.
2020-04-12 22:30:30 -07:00
Michael Davidsaver 3b641bed84 start *IDs from different non-zero
Help detect situations where SID, CID, or IOID are mixed up
2020-04-07 13:28:06 -07:00
Michael Davidsaver edadc31f96 add instanceSnapshot() 2020-03-24 18:38:10 -07:00
Michael Davidsaver 25e712eb2a client Add Operation::wait() 2020-03-12 19:52:00 -07:00
Michael Davidsaver c7ba7d21b6 add client monitor 2020-03-04 19:57:00 -08:00
Michael Davidsaver c127e5ae1f do beacon clean on UDP worker 2020-03-02 15:37:43 -08:00
Michael Davidsaver a3ffbd2a9b client fix Channel reconnect 2020-03-02 15:37:43 -08:00
Michael Davidsaver e668038250 client track opByIOID per channel
needed to handle CMD_DESTROY_CHANNEL
2020-03-02 15:37:43 -08:00
Michael Davidsaver 20acafa963 fix Connection ownership
Keep alive during bev*() callbacks
2020-03-02 15:37:43 -08:00
Michael Davidsaver b52065ccad client get/put/rpc 2020-02-26 08:38:15 -08:00
Michael Davidsaver acfba6469e start client beacon rx 2020-02-26 08:38:15 -08:00
Michael Davidsaver 7d490dc69e client info() error delivery 2020-02-21 11:54:01 -08:00