David Vossel
ad248a733e
Low: ipcs: Cleanup unnecessary reference counting
2014-04-04 12:12:58 -05:00
David Vossel
c89b11c6b5
High: ipc: Fixes memory leak in server connection accept when client partially connects
2014-01-15 11:43:46 -06:00
David Vossel
9f6e4bb52d
Feature: Enforce buffer size limits on the server side
2013-11-18 16:51:31 -06:00
David Vossel
2b11b783c7
High: ipcs: Api function allowing server to retrieve client connection's ipc buffer size
2013-10-08 17:11:53 -05:00
David Vossel
73827cfc5a
Fixes use after free during ipcs client disconnect
2013-07-22 15:50:04 -05:00
David Vossel
70a7aca77f
Remove dead code
2013-07-22 15:43:54 -05:00
David Vossel
40e163adba
Fixes travis build error
2013-07-19 14:15:34 -05:00
David Vossel
6cf5a3b3db
Low: ipcs: For shm ipc, always retry outstanding notifications when next event is sent
2013-07-18 21:59:59 -05:00
David Vossel
71979d7796
Fix: ipcs: Fixes compile time issue reported by travis
2013-07-12 21:58:51 -05:00
David Vossel
be975f9de0
Low: ipcs: Attempt to resend outstanding event notifications during event send
2013-07-12 18:45:21 -05:00
David Vossel
ff180f7a55
Fix: ipcs: Disconnect shm ipc connection when poll socket returns error on msg receive
2013-07-01 19:20:51 -05:00
David Vossel
95e48fdb76
Fix: ipcs: Properly disconnect client connection on POLLNVAL or any other error causing connection removal from mainloop.
...
qb_ipcs_dispatch_connection_request is a callback function registered with
mainloop, or whatever other looping thread implementation is in use. When
this callback is registered, a reference of the connection object is given
to the mainloop thread. If this callback ever returns something none zero
the callback (and corresponding fd) is unregistered from the loop automatically,
so we must decrement the reference in this instance.
Since unregistering this callback from mainloop guarantees a disconnect
simply because requests on the fd are no longer processed, it is best
that we completely disconnect the connection (which will handle the unref)
when this callback returns an error... Otherwise since the fd is unregistered
from the mainloop thread, it may not be possible to detect a disconnect
in the future.
2013-07-01 18:46:31 -05:00
David Vossel
abdf8cd94a
Simplify internal ipcs ref counting, add comments and document api behavior
2013-06-28 20:27:02 -05:00
David Vossel
8466fba749
Simplifies connection ref counting without changing behavior
2013-06-28 20:26:24 -05:00
David Vossel
a8d4e9fdb5
Fix: refcount leak
2013-06-27 19:33:18 -05:00
Michael van der Westhuizen
652766c002
Add a IPC service context pointer and accessors from both the connection and service level.
2013-05-25 22:57:53 +01:00
Angus Salkeld
f54764e1ec
IPC: make each connection ref the owning service
...
This is because the connection functions use the c->service pointer
and this needs to be mirrored in the reference counting.
The service can only be free'd when all connections are destroyed
and the user as unreferenced all previously referenced connections
and the service.
Fixes #62
Thanks to Jan Friesse for the reproducer
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-04-22 12:03:26 +10:00
Angus Salkeld
31d9f0900d
Use dgram sockets for message oriented communications
...
This is to prevent partial sends and gettting stuck in
retry loops.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-02-18 20:51:33 +11:00
Angus Salkeld
dde6a46a83
IPC: make sure we return a consistent error when the message is too big.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2013-01-25 11:20:19 +11:00
Takeshi MIZUTA
96e504f305
Unify the list processing with qb_list function
2013-01-09 02:04:20 +09:00
Angus Salkeld
fe45c27ea6
IPC: don't over log on disconnect
...
Thanks grueni: https://github.com/asalkeld/libqb/pull/43
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:46:01 +11:00
Angus Salkeld
c7810b38b1
Remove IPC_NEEDS_RESPONSE_ACK and turn off shm ipc on solaris
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-31 14:53:38 +10:00
Angus Salkeld
988c1e259c
Fix splint warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 23:29:05 +10:00
Angus Salkeld
cceb4e2e5f
Avoid strcpy() use strlcpy() instead.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:31:57 +10:00
Angus Salkeld
10045dd561
Some missing pshared semaphore checks
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 12:26:47 +10:00
Angus Salkeld
873e467cf8
Cleanup the checks for pshared semaphores
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 10:22:56 +10:00
Angus Salkeld
50632154ed
Catch disconnected sockets on Solaris
...
It seems like poll() was not producing a POLLHUP
so we rely on qb_ipc_us_recv() returning -ENOTCONN.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-24 11:49:07 +10:00
Jim Meyering
c60f5012ea
ipcs: avoid use-after-free for size-0 || disconnect-request
...
Hi,
Glancing through coverity-reported issues,
I saw that this one required attention:
From 70f1f689022321710405f16dc45b3df30c22bc59 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 18 Jul 2012 17:34:17 +0200
Subject: [PATCH] ipcs: avoid use-after-free for size-0 || disconnect-request
spotted by coverity:
http://libqb.org/html/0.14.1/coverity/1/265ipcs.c.html#error
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-19 08:19:22 +10:00
Angus Salkeld
740f9df7ac
Fix a valgrind error.
...
just use the receive buffer, as it will be big enough.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-14 22:29:25 +10:00
Angus Salkeld
22569f51ba
Add user control of the permissions that are set on the shared mem files
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-13 08:21:09 +10:00
Angus Salkeld
73731f0643
IPC: if the server returns EAGAIN or ETIMEOUT the check the connection
...
Mainly useful for shm, as the ringbuffer doesn't know the state
of the connection.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 13:46:58 +10:00
Angus Salkeld
1e81530332
IPC: On bsd's use the notifier for responses
...
The point of this is to catch connection failures
more reliably.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-01 11:12:44 +10:00
Angus Salkeld
70a9623a48
Remove message queues
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:41:04 +10:00
Angus Salkeld
0458c5ccd2
IPC: log the connection description in all logs
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:59:12 +10:00
Angus Salkeld
78374c2ed3
IPC: only modify the dispatch if we get EAGAIN
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:19:41 +10:00
Angus Salkeld
908bdfd172
IPC: add a new function to get (and alloc) the extended stats.
...
This should handle any further additions to the stats
as the library allocs the struct.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-10 20:20:29 +10:00
Angus Salkeld
c221922291
Revert "Add the event queue length to the connection stats."
...
This reverts commit 6b7da3f531 .
2012-05-10 16:09:48 +10:00
Angus Salkeld
9f09aba8dd
IPC: handle a connection disconnect from the server better
...
Only problem with SOCKET.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-02 10:15:19 +10:00
Angus Salkeld
6b7da3f531
Add the event queue length to the connection stats.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-01 13:22:16 +10:00
Angus Salkeld
d80f218133
Handle a recv of size 0
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-04-04 21:57:49 +10:00
Angus Salkeld
c97113bd83
Fix a bug introduced by the bsd patch.
...
I missed the non-native case.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-27 20:57:10 +11:00
Angus Salkeld
1af214d91d
Try and improve the portability on bsd variants.
...
Also add a QB_IPC_NATIVE type that selects the best ipc type available.
Signed-off-by: Angus <angus@anguss-mac-mini>
2012-03-24 22:43:37 +11:00
Angus Salkeld
58bc8e6bb4
IPC: make the _request_q_len_get() function more obvious.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:34:50 +11:00
Angus Salkeld
c2f5f94312
IPC: make sure that the wrong union member is not written to.
...
Move the connection type into the one_way struct. Seem
like a more obvious place for it next to the union.
Also it will help prevent issues like in qb_ipc_us_recv()
where there is a rather dodgy access of ctl->sent.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:18:02 +11:00
Angus Salkeld
7a6382f0b6
Use safer versions of string functions (strcpy -> strlcpy)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
a95618ddd3
Fix some issues found by clang
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-03 14:37:37 +11:00
Angus Salkeld
86428907c7
IPC: merge common code into new function
...
This also fixes a regression caused by:
42c92fb675
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-31 11:34:50 +11:00
Angus Salkeld
55e4c3048a
IPC: fix scary typo
...
Not sure how this happened
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-27 22:28:44 +11:00
Angus Salkeld
42c92fb675
IPC: fix server error handling
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-27 22:27:08 +11:00
Angus Salkeld
295f7e48bb
IPC: check for the server liveness before disconnecting.
...
if the server is dead then is_connected will cause the resourses
to be properly cleaned up.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-21 22:05:50 +11:00