Commit Graph

81 Commits

Author SHA1 Message Date
Michael Davidsaver 20e0fa8ca5 client: re-define the meaning of poke() 2023-04-17 15:54:29 -05:00
Michael Davidsaver dd2f076b4a client: only advance search bucket during normal search 2023-04-17 15:54:29 -05:00
Michael Davidsaver fe5a35eb02 client: only reschedule searchTimer on expiry 2023-04-14 10:14:30 -07: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 303bc61079 apply loc_bad_alloc to owned_ptr
Distinguish location of owned_ptr failure
2023-03-28 15:21:39 -07:00
Michael Davidsaver 0de17036f4 add Context::close() 2022-11-27 08:20:13 -08:00
Michael Davidsaver cfde0e26d8 avoid assert for mostly absurdly long PV names
Longer than typical ethernet MTU,
but less than UDP packet limit.
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 de7e8c3798 Add ConnectBuilder::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 cce797263d fix handling of pva_ctrl_msg::SetEndian 2022-05-18 10:32:16 -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 1040e87f39 add SockAddr::isMCast() and capacity() 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 47ebfd5371 Accept CMD_ORIGIN_TAG
Implement local mcast hack
2022-04-05 07:57:16 -07:00
Michael Davidsaver 290b565203 minor 2022-04-05 07:57:16 -07:00
Michael Davidsaver f67f27e96b Portable capture of destination interface and IP address
Use recvmsg() and control messages IP_PKTINFO (Linux, OSX, Windows)
or IP_ORIGDSTADDR and IP_RECVIF (RTEMS w/ libbsd) to find the
index of the logical interface through which a UDP packet was received,
and the destination address from the IPv4 header.

Also, clear IP_MULTICAST_ALL on Linux to disable non-compliant legacy brokenness
and receive only those multicasts we are interested in.
2022-04-05 07:57:16 -07:00
Michael Davidsaver 98edf61de8 Add client/server fromEnv() without temporary Config on caller stack 2021-08-06 12:34:32 -07:00
Michael Davidsaver d6bf565ed6 rename interfaces() -> broadcasts() 2021-08-04 17:26:10 -07:00
Michael Davidsaver 3145c010d2 Extend report()
ReportInfo to allow pass through from Source.
Also include peer credentials
2021-07-06 18:32:53 -07:00
Michael Davidsaver 99c1534dfa client: add ConnectBuilder::syncCancel() 2021-07-06 18:32:53 -07:00
Michael Davidsaver 9af841cccd server/client search logging 2021-07-06 18:32:53 -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 0e5bd37b6e minor 2021-07-02 13:15:50 -07:00
Michael Davidsaver bc1cc57f1e client: cacheClear() partial 2021-06-27 10:17:14 -07:00
Michael Davidsaver 69ed03e508 client: fix bcast addr id 2021-06-27 10:17:14 -07:00
Michael Davidsaver e3465b7ee8 plumb file+line through _to_wire/_from_wire 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 4683d56421 client/server report tx/rx counts 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 a4c06fe423 minor 2021-06-02 14:47:39 -05:00
Michael Davidsaver b38b33db03 raise search reply processing limit
Seems pvAccessCPP likes to send lots of individual replies
to our nicely batched search requests.
2021-02-12 11:19:46 -08: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 84ef355a4a client: try not to fragment search packets 2021-01-28 07:44:32 -08:00
Michael Davidsaver e9ce80880d remote file:line from decode errors 2021-01-12 11:32:10 -08:00
Michael Davidsaver 76764cf978 xcode: capture file:line of fault() 2021-01-12 11:32:10 -08:00