Commit Graph

858 Commits

Author SHA1 Message Date
Andrew Johnson
98e81a542e Use epicsMutex and epicsEvent instead of pv::data equivalents 2021-01-05 11:01:02 -08:00
Andrew Johnson
0332d0f2c1 notifierConveyer destruction protection
Remove the work variable
2021-01-05 11:01:02 -08:00
Andrew Johnson
345f2782cd caContext: Restore existing context in constructor
Don't assume other code might be using our context.
Fix destructor to reattach the right context.
2021-01-05 11:01:02 -08:00
Andrew Johnson
b0b2228558 Make ca::Attach::context a reference, not a smart pointer 2021-01-05 11:01:02 -08:00
Andrew Johnson
92002b6ba2 Include pvAccess.h before exportSharedSym's in caContext.cpp 2021-01-05 11:01:02 -08:00
Andrew Johnson
33cc9b1fdb Define epicsExportSharedSymbols in ca/notifierConveyor.cpp 2021-01-05 11:01:02 -08:00
Andrew Johnson
8b3a057a69 Have notifierConveyor trap and drop any exceptions 2021-01-05 11:01:02 -08:00
Andrew Johnson
f9c40e96cf Collect ca_client_context operations
Each instance of the caContext class represents a separate CA context,
so each CAChannelProvider creates one and keeps a shared_ptr to it,
making that available to its channels and channel operations. These
also take their own shared_ptr to it as well so the context cannot be
destroyed while it might be needed.

A related caContext Attach object is intended to be short-lived, and
to be allocated on the stack. When created it saves the current CA
context for the thread, replacing it from the caContext given to its
constructor. CA operations will now use the attached context. When the
Attach destructor runs it detaches the thread from the current context
(checking still has the expected value) and re-attaches the thread to
any context that was saved by the constructor.
2021-01-05 11:01:02 -08:00
Andrew Johnson
25dde0f4ba Make Codacy happier 2021-01-05 11:01:02 -08:00
Andrew Johnson
06c2fb579f Replaced 4 notification threads with 2 notifierConveyors
Channel connection notifications are now handled by connectNotifier,
getDone, putDone and monitor events handled by resultNotifier.
A notifierConveyor is generic, and contains a queue and a thread.
You pass a Notification pointing to a NotifierClient to a Conveyor's
notifyClient() method, and the thread will call the client's
notifyClient() method once it reaches the front of the queue.

The conveyor threads stop when the caProvider is destroyed.
The queue stores weak pointers, so queued notifications won't prevent
client objects from being destroyed.
2021-01-05 11:01:02 -08:00
Andrew Johnson
2729903a10 Make the channelConnectThread per-provider
This passes the tests (on MacOS).
2021-01-05 11:01:02 -08:00
Andrew Johnson
601280836d Move caProvider worker threads shutdown to static destructors 2021-01-05 11:01:02 -08:00
Andrew Johnson
44fda51935 Start of major overhaul
Moved duplicated EXCEPTION_GUARD macro to private header file.
Removed all DEBUG_LEVEL and similar prints.
Some reformatting and code simplification.
2021-01-05 11:01:02 -08:00
Andrew Johnson
9671ee132e caProvider threads: Lock the mutex while reading isStop state 2021-01-05 11:01:02 -08:00
Michael Davidsaver
d005260017 hackAroundRTEMSSocketInterrupt 2020-11-22 11:58:33 -08:00
Michael Davidsaver
fc4e3c5d44 discoverInterfaces() correctly ignore non-IPv4 addresses
Must check sa_family early, before attempting to copy
in case sockaddr needs more storage than sockaddr_in.
2020-11-21 10:32:18 -08:00
Michael Davidsaver
325b138467 Revert "Add support for socket addresses other then IPv4"
This reverts commit 7db4f94b8b.
2020-11-21 10:31:22 -08:00
Michael Davidsaver
862f08a9d3 Revert "Add check for the definition "darwin" to support Mac"
This reverts commit 53cd4fa3ef.
2020-11-21 10:31:22 -08:00
Michael Davidsaver
3b2261a61f Remove unused alignBuffer() and alignData() 2020-11-14 12:01:47 -08:00
Michael Davidsaver
564f19e466 handle exception in authGblInit()
Don't allow c++ exceptions to propagate to epicsThreadOnce()
2020-11-10 23:03:48 -08:00
Heinz Junkes
53cd4fa3ef Add check for the definition "darwin" to support Mac 2020-08-20 12:00:06 +02:00
Heinz Junkes
af550178e8 Merge branch 'fixUtils' 2020-08-19 16:38:05 +02:00
Heinz Junkes
7db4f94b8b Add support for socket addresses other then IPv4 2020-08-19 16:07:11 +02:00
Michael Davidsaver
53d18e6a03 SharedPV handle bad_weak_ptr earlier
Avoid operating on partly destroyed object.
2020-06-15 09:37:11 -07:00
Michael Davidsaver
a97c5b1cbb SharedPV::post() handle bad_weak_ptr 2020-06-15 09:25:31 -07:00
Michael Davidsaver
3f050f3533 avoid unnecessary re-throw
"Failed to initialize UDP transport"
is not a useful error message
2020-06-06 08:01:52 -07:00
Michael Davidsaver
598fa1e596 make Destroyable::destroy() optional 2020-06-03 15:55:09 -07:00
3ba6679e67 removed spaces at end of line 2020-04-15 08:17:03 -07:00
40300a12cb replaced tabs with spaces 2020-04-15 08:17:03 -07:00
Michael Davidsaver
ef4bf9120e client: fix mixed up CID/SID in CMD_DESTROY_CHANNEL handler
servers send SID then CID
2020-04-07 13:13:23 -07:00
Michael Davidsaver
19d868eb7d start CID, SID, and IOID from different non-zero
Help to detect situations where these IDs get mixed up
2020-04-07 13:08:55 -07:00
Michael Davidsaver
4ef9c1102b no "invalid bit-set length"
Not actually an error case as BitSet storage is compacted.
2020-03-18 09:35:34 -07:00
Michael Davidsaver
245a09a199 client unconditionally clear existingBitSet
When reused (after reconnect) need to clear mask from previous
operation, which may be a different type from a different server
and just happen to have the same number of bits.
2020-03-18 09:35:34 -07:00
Heesterman, Peter J
208eef0962 Static analysis of epics base during the Codathon at Diamond. 2020-02-17 12:04:43 +00:00
Heesterman, Peter J
ddc5d261cb #inlcude <pv/refTrack.h> is incorrectly located w.r.t. #define epicsExportSharedSymbols.
The header file imports definitions from pvData into the module.
It does not export from this module.

This causes DLL build problems on Windows.
2020-02-17 12:04:05 +00:00
Michael Davidsaver
4c1ed86f96 add pval
List names from all ChannelProviders.
2020-01-16 09:50:34 -08:00
Michael Davidsaver
642168efe1 ipAddrToDottedIP() consistent buffer size
IPv4 + port "XXX.XXX.XXX.XXX:12345" is 4*4 + 5 + 1 == 22

rounding up to 24 for no good reason.
2020-01-16 09:22:23 -08:00
Michael Davidsaver
0fdd3a7079 bind() error msg buffer too small 2020-01-16 09:16:23 -08:00
Michael Davidsaver
7903a736d4 avoid ipAddrToA() 2019-11-24 19:37:08 -08:00
Michael Davidsaver
135bf7265c fully fix AuthorizationRegistry race 2019-10-31 07:43:48 -07:00
Michael Davidsaver
7bc5bc2cbc fix AuthorizationRegistry race
oops.  should only prevent add/remove while iterating,
not concurrent iteration.
2019-10-10 15:12:58 -07:00
Michael Davidsaver
f81ebae455 minor log 2019-10-10 15:12:58 -07:00
Michael Davidsaver
b24afb9d33 osdGetRoles() avoid fault when gid==0
Attempt to detect misbehaving getgrouplist()
fails when user is actually a member of
group 0 (aka. root).

Instead, fill with (gid_t)-1 which seems less likely
to cause problems if erroneously grant.
2019-09-12 09:32:57 -07:00
Michael Davidsaver
24e83daaba pvac::Monitor::cancel() don't clear data members
Clearing root, overrun, and changed makes it difficult
to avoid a race during an async. cancel (very common).
2019-09-11 18:05:08 -07:00
Michael Davidsaver
03b0121021 server fail to start w/ invalid EPICS_PVAS_INTF_ADDR_LIST 2019-08-20 15:53:06 -07:00
Michael Davidsaver
89bbe09b02 cleanup unused accessors 2019-08-20 15:53:03 -07:00
Michael Davidsaver
aafb12f562 SharedPV separate close() and disconnect()
Previously, SharedPV::close() and StaticProvider::close()
would both disconnect all active clients, and put the SharedPV
in a closed (untyped) state.

SharedPV::close() remains unchanged.

StaticProvider::close() now only disconnects Channels created
through it, and leaves SharedPVs in the opened state.
2019-08-20 15:52:59 -07:00
Michael Davidsaver
50de6cc58e remove 3.14 compatibility 2019-08-20 15:52:56 -07:00
Michael Davidsaver
99d66750fb Merge remote-tracking branch 'md/txrxstats'
* md/txrxstats:
  stop testing against Base 3.14
  bytes tx/rx stats per socket and per Operation
2019-08-20 15:52:49 -07:00
Michael Davidsaver
a22f866211 mask warnings during shutdown()
On some target (OSX), and interrupted recv() will
return with a a spurious error (EBADF).
2019-07-24 16:08:00 -07:00