~ubuntu-branches/ubuntu/vivid/haproxy/vivid

« back to all changes in this revision

Viewing changes to src/proxy.c

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2008-06-20 00:38:50 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080620003850-hvvx94g2xz2l2xbg
Tags: 1.3.15.1-1
* New Upstream Version
* Upgrade standards version to 3.8.0 (no change needed).
* Build with TARGET=linux26 on linux, TARGET=generic on other systems.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
                tv = &proxy->timeout.connect;
119
119
                td = &defpx->timeout.connect;
120
120
                cap = PR_CAP_BE;
 
121
        } else if (!strcmp(args[0], "check")) {
 
122
                tv = &proxy->timeout.check;
 
123
                td = &defpx->timeout.check;
 
124
                cap = PR_CAP_BE;
121
125
        } else if (!strcmp(args[0], "appsession")) {
122
126
                tv = &proxy->timeout.appsession;
123
127
                td = &defpx->timeout.appsession;
128
132
                cap = PR_CAP_BE;
129
133
        } else {
130
134
                snprintf(err, errlen,
131
 
                         "timeout '%s': must be 'client', 'server', 'connect', "
 
135
                         "timeout '%s': must be 'client', 'server', 'connect', 'check', "
132
136
                         "'appsession', 'queue', 'http-request' or 'tarpit'",
133
137
                         args[0]);
134
138
                return -1;
172
176
 
173
177
struct proxy *findproxy(const char *name, int mode, int cap) {
174
178
 
175
 
        struct proxy *curproxy, *target=NULL;
 
179
        struct proxy *curproxy, *target = NULL;
176
180
 
177
181
        for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
178
182
                if ((curproxy->cap & cap)!=cap || strcmp(curproxy->id, name))
200
204
}
201
205
 
202
206
/*
 
207
 * This function finds a server with matching name within selected proxy.
 
208
 * It also checks if there are more matching servers with
 
209
 * requested name as this often leads into unexpected situations.
 
210
 */
 
211
 
 
212
struct server *findserver(const struct proxy *px, const char *name) {
 
213
 
 
214
        struct server *cursrv, *target = NULL;
 
215
 
 
216
        if (!px)
 
217
                return NULL;
 
218
 
 
219
        for (cursrv = px->srv; cursrv; cursrv = cursrv->next) {
 
220
                if (strcmp(cursrv->id, name))
 
221
                        continue;
 
222
 
 
223
                if (!target) {
 
224
                        target = cursrv;
 
225
                        continue;
 
226
                }
 
227
 
 
228
                Alert("Refusing to use duplicated server '%s' fould in proxy: %s!\n",
 
229
                        name, px->id);
 
230
 
 
231
                return NULL;
 
232
        }
 
233
 
 
234
        return target;
 
235
}
 
236
 
 
237
/*
203
238
 * This function creates all proxy sockets. It should be done very early,
204
239
 * typically before privileges are dropped. The sockets will be registered
205
240
 * but not added to any fd_set, in order not to loose them across the fork().