~mdw
/
fwd
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Document lots of new features and syntax.
[fwd]
/
chan.c
diff --git
a/chan.c
b/chan.c
index
55e6a75
..
855c769
100644
(file)
--- a/
chan.c
+++ b/
chan.c
@@
-1,10
+1,10
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: chan.c,v 1.
1 1999/07/01 08:56:23
mdw Exp $
+ * $Id: chan.c,v 1.
2 1999/07/26 23:27:52
mdw Exp $
*
* Channel management
*
*
* Channel management
*
- * (c) 1999
Mark Wooding
+ * (c) 1999
Straylight/Edgeware
*/
/*----- Licensing notice --------------------------------------------------*
*/
/*----- Licensing notice --------------------------------------------------*
@@
-29,8
+29,11
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: chan.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: chan.c,v $
- * Revision 1.1 1999/07/01 08:56:23 mdw
- * Initial revision
+ * Revision 1.2 1999/07/26 23:27:52 mdw
+ * Minor modifications for new design.
+ *
+ * Revision 1.1.1.1 1999/07/01 08:56:23 mdw
+ * Initial revision.
*
*/
*
*/
@@
-114,10
+117,8
@@
static void writechan(int fd, unsigned mode, void *vp)
/* --- Close the output end if necessary --- */
/* --- Close the output end if necessary --- */
- if (c->len == 0 && (c->f & CHANF_CLOSE)) {
- shutdown(fd, 1);
+ if (c->len == 0 && (c->f & CHANF_CLOSE))
c->func(c->p);
c->func(c->p);
- }
return;
/* --- Force a close if an error occurred --- */
return;
/* --- Force a close if an error occurred --- */
@@
-167,7
+168,7
@@
static void readchan(int fd, unsigned mode, void *vp)
}
else if (r == 0)
goto close;
}
else if (r == 0)
goto close;
- else if (c->len == 0 &&
!
(c->f & CHANF_READY))
+ else if (c->len == 0 && (c->f & CHANF_READY))
sel_addfile(&c->w);
c->len += r;
if (c->len == CHAN_BUFSZ)
sel_addfile(&c->w);
c->len += r;
if (c->len == CHAN_BUFSZ)
@@
-178,7
+179,7
@@
static void readchan(int fd, unsigned mode, void *vp)
close:
c->f |= CHANF_CLOSE;
close:
c->f |= CHANF_CLOSE;
- if (!c->len)
+ if (!c->len
&& (c->f & CHANF_READY)
)
sel_addfile(&c->w);
sel_rmfile(&c->r);
}
sel_addfile(&c->w);
sel_rmfile(&c->r);
}
@@
-216,8
+217,9
@@
void chan_dest(chan *c, int fd)
if (c->f & CHANF_READY)
return;
sel_initfile(sel, &c->w, fd, SEL_WRITE, writechan, c);
if (c->f & CHANF_READY)
return;
sel_initfile(sel, &c->w, fd, SEL_WRITE, writechan, c);
- if (c->len)
+ if (c->len
|| (c->f & CHANF_CLOSE)
)
sel_addfile(&c->w);
sel_addfile(&c->w);
+ c->f |= CHANF_READY;
}
/* --- @chan_open@ --- *
}
/* --- @chan_open@ --- *