chiark
/
gitweb
/
~mdw
/
fwd
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various: Report errors encountered while doing channel I/O.
[fwd]
/
endpt.c
diff --git
a/endpt.c
b/endpt.c
index a1b6ac785aed9c92a15d59395418bdac8e5c39f4..1fbf1880d76078069f33319eae842df28276c0bd 100644
(file)
--- a/
endpt.c
+++ b/
endpt.c
@@
-47,6
+47,7
@@
typedef struct chanpair {
typedef struct tango {
struct tango *next, *prev; /* A big list of all tangos */
endpt *a, *b; /* The two endpoints */
typedef struct tango {
struct tango *next, *prev; /* A big list of all tangos */
endpt *a, *b; /* The two endpoints */
+ char *desc; /* Description of the connection */
unsigned s; /* State of the connection */
chanpair *c; /* The pair of channels */
} tango;
unsigned s; /* State of the connection */
chanpair *c; /* The pair of channels */
} tango;
@@
-121,6
+122,10
@@
void endpt_kill(endpt *a)
*/
if (a->f & b->f & EPF_FILE) {
*/
if (a->f & b->f & EPF_FILE) {
+ if (t->c->ab.err)
+ fw_log(-1, "[%s] error: %s", t->desc, strerror(t->c->ab.err));
+ else if (t->c->ba.err)
+ fw_log(-1, "[%s] error: %s", t->desc, strerror(t->c->ba.err));
if (t->s & EPS_AB)
chan_close(&t->c->ab);
if (!(b->f & EPF_PENDING) && (t->s & EPS_BA))
if (t->s & EPS_AB)
chan_close(&t->c->ab);
if (!(b->f & EPF_PENDING) && (t->s & EPS_BA))
@@
-139,6
+144,8
@@
void endpt_kill(endpt *a)
t->prev->next = t->next;
else
tangos = t->next;
t->prev->next = t->next;
else
tangos = t->next;
+ if (t->desc)
+ xfree(t->desc);
DESTROY(t);
}
DESTROY(t);
}
@@
-167,6
+174,7
@@
void endpt_killall(void)
*
* Arguments: @endpt *a@ = pointer to first endpoint
* @endpt *b@ = pointer to second endpoint
*
* Arguments: @endpt *a@ = pointer to first endpoint
* @endpt *b@ = pointer to second endpoint
+ * @const char *desc@ = description of connection
*
* Returns: ---
*
*
* Returns: ---
*
@@
-174,9
+182,13
@@
void endpt_killall(void)
* which are already joined; in fact, the the right thing to do
* when your endpoint decides that it's not pending any more is
* to join it to its partner again.
* which are already joined; in fact, the the right thing to do
* when your endpoint decides that it's not pending any more is
* to join it to its partner again.
+ *
+ * If the endpoints are already connected then the description
+ * string is ignored. The endpoint manager takes a copy of the
+ * string, so you don't need to keep it around.
*/
*/
-void endpt_join(endpt *a, endpt *b)
+void endpt_join(endpt *a, endpt *b
, const char *desc
)
{
tango *t = a->t;
{
tango *t = a->t;
@@
-191,6
+203,7
@@
void endpt_join(endpt *a, endpt *b)
a->t = b->t = t;
t->s = EPS_AB | EPS_BA;
t->c = 0;
a->t = b->t = t;
t->s = EPS_AB | EPS_BA;
t->c = 0;
+ t->desc = xstrdup(desc);
if (tangos)
tangos->prev = t;
tangos = t;
if (tangos)
tangos->prev = t;
tangos = t;