From: Sergey Vlasov <vsu@altlinux.ru> To: community@lists.altlinux.org Subject: Re: [Comm] [p6] тестирование новых freerdp и remmina Date: Sun, 26 Feb 2012 19:58:02 +0400 Message-ID: <20120226155802.GB6389@atlas.home> (raw) In-Reply-To: <CAMBdDKrxpLTgFcc+7nuD71eP8-L+pkeEb+ayTYXOvKJeV_FB8w@mail.gmail.com> [-- Attachment #1: Type: text/plain, Size: 2059 bytes --] On Sun, Feb 26, 2012 at 02:21:59PM +0100, vx8400 wrote: > Спасибо за замечание по read/errno. Проверка делалась для конкретного > случая, чтобы дать remmina дойти до своей ошибки в glib/gtk. > Чтобы не морочиться с read(tls->ssl-> ...) и errno: > > boolean tls_disconnect(rdpTls* tls) > { > uint8 _buf_[8]; > if (tls_read(tls,_buf_,0) < 0) > fprintf(stderr,"ERROR: connection is already dead, won't call > SSL_shutdown(), returning true despite this\n"); > else > SSL_shutdown(tls->ssl); > return true; > } Всё равно там race - пакет с другой стороны может дойти уже после завершения tls_read(), и получится тот же SIGPIPE. > > Хотя в любом случае всё это не поможет, поскольку закрытие соединения > > со стороны сервера может произойти после проверки, но перед вызовом > > SSL_shutdown(). Единственный надёжный способ борьбы с проблемой - > > игнорировать сигнал SIGPIPE и обрабатывать ошибку EPIPE от write(); > > странно, почему xfreerdp этого не делает. > > Почему сам SSL_shutdown() не проверяет соединение перед записью в > сокет и доводит до SIGPIPE? Очевидно, разработчики OpenSSL рассчитывали на то, что программы, использующие эту библиотеку, будут игнорировать SIGPIPE. На самом деле, помимо signal(SIGPIPE, SIG_IGN), существует ещё несколько способов бороться с SIGPIPE, но большинство этих способов не являются универсальными и переносимыми на различные ОС (видимо, поэтому в OpenSSL ни один из них и не применяется): http://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly В glib2 тоже не стали заморачиваться с хитрыми способами, и просто всадили игнорирование SIGPIPE в инициализацию GSocket, хотя подобные глобальные изменения в библиотеках и считаются дурным тоном: http://git.altlinux.org/srpms/g/glib2.git?p=glib2.git;a=blob;f=glib/gio/gsocket.c;h=a03be77768e9d926cd31e9eafd39d5a4374d1e2f;hb=HEAD#l110 http://git.altlinux.org/srpms/g/glib2.git?p=glib2.git;a=blob;f=glib/gio/gsocket.c;h=a03be77768e9d926cd31e9eafd39d5a4374d1e2f;hb=HEAD#l704 [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-02-26 15:58 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-02-21 13:33 Андрей Черепанов 2012-02-21 20:04 ` Sergey Vlasov 2012-02-21 20:13 ` vx8400 2012-02-22 9:03 ` Андрей Черепанов 2012-02-21 20:17 ` Sergey Vlasov 2012-02-22 9:01 ` Андрей Черепанов 2012-02-22 9:19 ` Alexey Borisenkov 2012-02-24 19:31 ` vx8400 2012-02-24 22:39 ` Dubrovskiy Viacheslav 2012-02-25 15:28 ` vx8400 2012-02-25 15:42 ` vx8400 2012-02-25 17:37 ` Dubrovskiy Viacheslav 2012-02-25 21:36 ` vx8400 2012-02-26 8:40 ` Sergey Vlasov 2012-02-26 13:21 ` vx8400 2012-02-26 15:58 ` Sergey Vlasov [this message] 2012-02-26 17:53 ` vx8400 2012-02-26 20:38 ` Sergey Vlasov 2012-02-22 12:13 ` Sergey Vlasov
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=20120226155802.GB6389@atlas.home \ --to=vsu@altlinux.ru \ --cc=community@lists.altlinux.org \ /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