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
Angus Salkeld
e15a48254a
ipc: make coverity happy.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-05 16:46:59 +11:00
Angus Salkeld
fa70ec98e8
IPC: remove fd from poll loop in the disconnect
...
Until now we have been relying on getting a POLLHUP, but
under heavy load we seem to get an old poll event
that cause a double deref of the connection object.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-03 13:49:18 +11:00
Angus Salkeld
c3eb1be7ed
IPC: add a new state to the connection state
...
This to handle disconnecting in a failure state (before
the connection has been established.
Another aspect to this is we don't want to call
connection_destroyed() if we haven't called
connection_created().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-03 13:49:15 +11:00
Angus Salkeld
ab3dc60f7f
Merge some portability changes from the mingw branch
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-21 14:23:43 +11:00
Andrew Beekhof
61d166abbc
Support compilation on Mac OSX
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:16:30 +11:00
Angus Salkeld
e0c5187023
IPC: provide finer grained flowcontrol
...
this will allow the user to control the behaviour better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-14 00:55:06 +11:00
Angus Salkeld
ef77398738
Fix errors found by api-sanity-autotest
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 17:16:19 +11:00
Angus Salkeld
0171399274
Remove unnecessary checks before free()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:41:32 +11:00
Angus Salkeld
98493d9ae8
Change Lindent options to break the procedure type.
...
so change:
int foo(void)
to
int
foo(void)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +10:00
Angus Salkeld
42e79dfd2f
IPC: use the correct pointer type.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-20 16:36:34 +10:00
Angus Salkeld
9666c392cb
Fix some spelling.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-02 11:40:39 +10:00
Angus Salkeld
da150fcb22
IPC: misc cleanup & logging improvements
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-31 19:03:50 +10:00
Angus Salkeld
ec15ca46f6
COV 15: fix potential reference after deref
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
2a1e9618d7
COV 14: fix potential dereference after free()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:37:13 +10:00
Angus Salkeld
ac929fc7cd
COV 2: fix unreachable code (move call to qb_ipcs_us_withdraw up)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 13:45:21 +10:00
Angus Salkeld
943b1c646b
fix the FIXME's Jim pointed out
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Jim Meyering
9c467cb150
add FIXME comments for other NULL-deref-upon-OOM problems
...
* lib/ipc_us.c (handle_new_connection):
* lib/loop_job.c (qb_loop_jobs_create):
* lib/loop_poll.c (qb_loop_poll_create):
* lib/loop_timerlist.c (qb_loop_timer_create):
* lib/ringbuffer.c (qb_rb_open):
* lib/ipcc.c (qb_ipcc_connect): Likewise.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00