[FUG-BR] [PATCH] Qmail abrindo muitas conexoes simultaneas para o mesmohost
Luiz Souza
luiz em visualconnect.com.br
Dom Maio 28 09:54:09 BRT 2006
Luiz Souza wrote:
> Ari Arantes wrote:
>> Rafael,
>>
>> Tudo que falou do qmail é verdade, eu sei que a versão netqmail-1.0.5
>> não é versão mais nova.. Na própria página diz que a 1.0.3 + patchs já
>> aplicados.
>>
>> Sempre gostei do qmail. Uso desde 1998. Nunca tive problemas com ele,
>> mas como falei, o que me incomoda é o fato de mandar várias conexões
>> simultâneas para o mesmo host.
>>
> (snip)
>
> tente este patch: (agora sim com sem as quebras de linha)
--- qmail-send.c.orig Sat May 27 12:09:30 2006
+++ qmail-send.c Sat May 27 15:51:11 2006
@@ -776,11 +776,13 @@
unsigned long delid;
seek_pos mpos;
stralloc recip;
+ stralloc remotedomain;
}
;
unsigned long masterdelid = 1;
unsigned int concurrency[CHANNELS] = { 10, 20 };
+unsigned int concurrencyremotedomain = 10;
unsigned int concurrencyused[CHANNELS] = { 0, 0 };
struct del *d[CHANNELS];
stralloc dline[CHANNELS];
@@ -811,7 +813,7 @@
while (!(d[c] = (struct del *) alloc(concurrency[c] * sizeof(struct del))))
nomem();
for (i = 0;i < concurrency[c];++i)
- { d[c][i].used = 0; d[c][i].recip.s = 0; }
+ { d[c][i].used = 0; d[c][i].recip.s = 0; d[c][i].remotedomain.s = 0; }
dline[c].s = 0;
while (!stralloc_copys(&dline[c],"")) nomem();
}
@@ -840,12 +842,33 @@
{
int i;
int c;
+ char *domain = (char *)0;
+ unsigned int remotedomain = 0;
c = jo[j].channel;
if (!flagspawnalive[c]) return;
if (!comm_canwrite(c)) return;
- for (i = 0;i < concurrency[c];++i) if (!d[c][i].used) break;
+ if (c == 1) { domain = recip; while(*domain) if (*domain++ == '@') break; }
+
+ for (i = 0;i < concurrency[c];++i)
+ {
+ if (remotedomain >= concurrencyremotedomain)
+ {
+ log3("warning: reach max count to remote domain [", domain, "]\n");
+ return;
+ }
+ if (d[c][i].used)
+ {
+ if (domain && str_diff(d[c][i].remotedomain.s, domain) == 0) ++remotedomain;
+ }
+ else
+ {
+ if (!stralloc_copys(&d[c][i].remotedomain,domain)) { nomem(); return; }
+ if (!stralloc_0(&d[c][i].remotedomain)) { nomem(); return; }
+ break;
+ }
+ }
if (i == concurrency[c]) return;
if (!stralloc_copys(&d[c][i].recip,recip)) { nomem(); return; }
@@ -1445,6 +1468,7 @@
if (control_readint(&lifetime,"control/queuelifetime") == -1) return 0;
if (control_readint(&concurrency[0],"control/concurrencylocal") == -1) return 0;
if (control_readint(&concurrency[1],"control/concurrencyremote") == -1) return 0;
+ if (control_readint(&concurrencyremotedomain,"control/concurrencyremotedomain") == -1) return 0;
if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0;
if (control_rldef(&bouncefrom,"control/bouncefrom",0,"MAILER-DAEMON") != 1) return 0;
if (control_rldef(&bouncehost,"control/bouncehost",1,"bouncehost") != 1) return 0;
>
> Nao se esqueca de configurar a nova variavel
> /var/qmail/control/concurrencyremotedomain para o numero maximo que vc
> deseja para as entregas por dominio.
>
> luiz
> -------------------------
> Histórico: http://www.fug.com.br/historico/html/freebsd/
> Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
Mais detalhes sobre a lista de discussão freebsd