From: "Прокопьев Евгений" <john@rmts.donpac.ru>
To: community@altlinux.ru
Subject: [Comm] xinetd и устойчивость связи
Date: Thu, 27 Mar 2003 11:03:20 +0300
Message-ID: <3E82B048.20802@rmts.donpac.ru> (raw)
Здравствуйте!
Возникла задача передачи файла с диалапных станций на сервер и
выполнения неких действий по окончании загрузки.
Идеальным выходом была бы возможность FTP-сервера запускать на
выполнение некий скрипт после возникновения некоторых событий (например,
окончания upload). Но такого ftp не нашли, поэтому был написан сервис,
работающий через xinetd (т.е. читающий файл с stdin) и выполняющий
указанные функции.
Его код выглядит примерно так (опущена авторизация и запуск скрипта):
/*********************************************************************/
read(0, &file_len, 4);
openlog(argv[0], 0, LOG_USER);
syslog(LOG_USER | LOG_DEBUG, "<< Fileload service started >>");
if (file_len)
{
syslog(LOG_USER | LOG_DEBUG, "Read data [%d bytes] ...", file_len);
unlink(file);
sprintf(file, "/home/%s/tmp/update.zip", user);
fd = open(file, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
do
{
bytes_read = read(0, buffer, buff_len);
if (bytes_read == -1)
{
syslog(LOG_USER | LOG_DEBUG, "Read error: %s", strerror(errno));
syslog(LOG_USER | LOG_DEBUG, "<< Fileload service read error >>");
closelog();
return 1;
}
all_read += bytes_read;
write(fd, buffer, bytes_read);
syslog(LOG_USER | LOG_DEBUG, "Buffer %d; All read %d; Read %d",
buff_len, all_read, bytes_read);
}
while (all_read < file_len);
close(file);
syslog(LOG_USER | LOG_DEBUG, "Save data into file %s...", file);
}
Ну так вот, проблема в том, что в пределах города этот сервис работает
(от разных провайдеров). А как только люди пытаются загрузить файл из
другого города (километров за 500, но звонят они, естественно не по
межгороду, а к своему провайдеру), в логе я вижу следующее:
Read data [741604 bytes] ...
Buffer 100000; All read 1412; Read 1412
Buffer 100000; All read 2824; Read 1412
Buffer 100000; All read 4236; Read 1412
Buffer 100000; All read 5648; Read 1412
Read error: Connection reset by peer
Никаким плохим диалапом это объяснено быть не может, т.к. стабильно
воспроизводится на линиях, которые заведомо лучше внутригородских.
Вопрос: в чем причина и что делать? Если необходимо увеличить время
ожидания, то где и как это делать?
--
С уважением, Прокопьев Евгений
reply other threads:[~2003-03-27 8:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E82B048.20802@rmts.donpac.ru \
--to=john@rmts.donpac.ru \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git