~ubuntu-branches/ubuntu/lucid/varnish/lucid

« back to all changes in this revision

Viewing changes to bin/varnishd/cache_pipe.c

  • Committer: Bazaar Package Importer
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2010-03-24 13:26:08 UTC
  • mfrom: (0.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100324132608-4uzkavctn26bdwyi
Tags: 2.1.0-1
* New upstream version
* Fix small error in man/vcl.7so

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*-
2
2
 * Copyright (c) 2006 Verdens Gang AS
3
 
 * Copyright (c) 2006-2008 Linpro AS
 
3
 * Copyright (c) 2006-2009 Linpro AS
4
4
 * All rights reserved.
5
5
 *
6
6
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
26
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
 * SUCH DAMAGE.
28
28
 *
29
 
 * $Id: cache_pipe.c 4248 2009-09-28 09:46:59Z tfheen $
30
 
 *
31
29
 * XXX: charge bytes to srcaddr
32
30
 */
33
31
 
34
32
#include "config.h"
35
33
 
 
34
#include "svnid.h"
 
35
SVNID("$Id: cache_pipe.c 4605 2010-03-09 11:27:08Z phk $")
 
36
 
36
37
#include <stdio.h>
37
38
#include <unistd.h>
38
39
#include <string.h>
67
68
{
68
69
        struct vbe_conn *vc;
69
70
        struct worker *w;
70
 
        struct bereq *bereq;
71
71
        struct pollfd fds[2];
72
72
        int i;
73
73
 
74
74
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
75
75
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
76
76
        w = sp->wrk;
77
 
        bereq = sp->bereq;
78
 
        sp->bereq = NULL;
79
77
 
80
 
        VBE_GetFd(sp);
 
78
        sp->vbe = VBE_GetFd(NULL, sp);
81
79
        if (sp->vbe == NULL)
82
80
                return;
83
81
        vc = sp->vbe;
84
 
        TCP_blocking(vc->fd);
 
82
        (void)TCP_blocking(vc->fd);
85
83
 
86
84
        WRW_Reserve(w, &vc->fd);
87
 
        sp->acct_req.hdrbytes += http_Write(w, bereq->http, 0);
 
85
        sp->acct_req.hdrbytes += http_Write(w, sp->wrk->bereq, 0);
88
86
 
89
87
        if (sp->htc->pipeline.b != NULL)
90
88
                sp->acct_req.bodybytes +=
91
89
                    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
92
90
 
93
91
        i = WRW_FlushRelease(w);
94
 
        VBE_free_bereq(&bereq);
95
92
 
96
93
        if (i) {
97
94
                vca_close_session(sp, "pipe");
103
100
 
104
101
        memset(fds, 0, sizeof fds);
105
102
 
106
 
        TCP_linger(vc->fd, 0);
 
103
        // XXX: not yet (void)TCP_linger(vc->fd, 0);
107
104
        fds[0].fd = vc->fd;
108
105
        fds[0].events = POLLIN | POLLERR;
109
106
 
110
 
        TCP_linger(sp->fd, 0);
 
107
        // XXX: not yet (void)TCP_linger(sp->fd, 0);
111
108
        fds[1].fd = sp->fd;
112
109
        fds[1].events = POLLIN | POLLERR;
113
110