/* cache_backend.c */
void VBE_Init(void);
struct vbe_conn *VBE_GetFd(struct sess *sp);
-void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already);
+void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc);
void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc);
struct bereq * VBE_new_bereq(void);
void VBE_free_bereq(struct bereq *bereq);
reuse = 1;
break;
}
- VBE_ClosedFd(sp->wrk, vc, 0);
+ VBE_ClosedFd(sp->wrk, vc);
}
if (vc == NULL) {
/* Close a connection ------------------------------------------------*/
void
-VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already)
+VBE_ClosedFd(struct worker *w, struct vbe_conn *vc)
{
CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC);
assert(vc->fd >= 0);
AN(vc->backend);
WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name);
- if (!already)
- AZ(close(vc->fd));
+ AZ(close(vc->fd));
vc->fd = -1;
vc->backend = NULL;
LOCK(&vbemtx);
TAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
}
- VBE_ClosedFd(sp->wrk, vc, 0);
+ VBE_ClosedFd(sp->wrk, vc);
return (-1);
}
cls = 1;
if (cls)
- VBE_ClosedFd(sp->wrk, vc, 0);
+ VBE_ClosedFd(sp->wrk, vc);
else
VBE_RecycleFd(sp->wrk, vc);
i = read(fds[idx].fd, buf, sizeof buf);
if (i <= 0 || fds[1-idx].events == 0) {
- VSL(SLT_Debug, fds[idx].fd, "Pipe Shut read(read)");
- VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut write(read)");
shutdown(fds[idx].fd, SHUT_RD);
shutdown(fds[1-idx].fd, SHUT_WR);
fds[idx].events = 0;
}
for (p = buf; i > 0; i -= j, p += j) {
j = write(fds[1-idx].fd, p, i);
- if (j < 0) {
- VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)");
- VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)");
+ if (j != i) {
shutdown(fds[idx].fd, SHUT_WR);
shutdown(fds[1-idx].fd, SHUT_RD);
fds[1-idx].events = 0;
if (WRK_Flush(w)) {
vca_close_session(sp, "pipe");
- VBE_ClosedFd(sp->wrk, vc, 0);
+ VBE_ClosedFd(sp->wrk, vc);
return;
}
rdf(fds, 1);
}
vca_close_session(sp, "pipe");
- (void)close (vc->fd);
- VBE_ClosedFd(sp->wrk, vc, 1);
+ VBE_ClosedFd(sp->wrk, vc);
}