~ubuntu-branches/ubuntu/precise/conserver/precise

« back to all changes in this revision

Viewing changes to conserver/client.c

  • Committer: Bazaar Package Importer
  • Author(s): Jörgen Hägg
  • Date: 2011-05-15 10:58:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110515105800-c18byqa1lfzoiz5t
Tags: 8.1.18-1
* new upstream version
* updated default config files (closes: #603055) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  $Id: client.c,v 5.91 2007/04/02 18:18:58 bryan Exp $
 
2
 *  $Id: client.c,v 5.93 2009/09/26 09:20:15 bryan Exp $
3
3
 *
4
4
 *  Copyright conserver.com, 2000
5
5
 *
61
61
    CONSENT *pCE;
62
62
#endif
63
63
{
 
64
    CONSCLIENT *pCLfound = (CONSCLIENT *)0;
64
65
    CONSCLIENT *pCL;
65
66
 
66
 
    /* make the first guy to have the `want write' bit set the writer
67
 
     * (tell him of the promotion, too)  we could look for the
68
 
     * most recent or some such... I guess it doesn't matter that
69
 
     * much.
 
67
    /* make the first guy (last on the list) to have the `want write' bit set
 
68
     * the writer (tell him of the promotion, too)  we could look for the most
 
69
     * recent or some such... I guess it doesn't matter that much.
70
70
     */
71
71
    if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly)
72
72
        return;
73
73
 
74
74
    for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
75
 
        if (!pCL->fwantwr || pCL->fro)
76
 
            continue;
77
 
        pCL->fwantwr = 0;
78
 
        pCL->fwr = 1;
 
75
        if (pCL->fwantwr && !pCL->fro)
 
76
            pCLfound = pCL;
 
77
    }
 
78
 
 
79
    if (pCLfound != (CONSCLIENT *)0) {
 
80
        pCLfound->fwantwr = 0;
 
81
        pCLfound->fwr = 1;
79
82
        if (pCE->nolog) {
80
 
            FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached (nologging)]\r\n",
81
 
                      -1);
 
83
            FileWrite(pCLfound->fd, FLAGFALSE,
 
84
                      "\r\n[attached (nologging)]\r\n", -1);
82
85
        } else {
83
 
            FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
 
86
            FileWrite(pCLfound->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
84
87
        }
85
 
        TagLogfileAct(pCE, "%s attached", pCL->acid->string);
86
 
        pCE->pCLwr = pCL;
87
 
        return;
 
88
        TagLogfileAct(pCE, "%s attached", pCLfound->acid->string);
 
89
        pCE->pCLwr = pCLfound;
88
90
    }
89
91
}
90
92