зеркало из https://github.com/github/ruby.git
* ext/socket/option.c (inspect_tcp_info): Permit longer data. (glibc
2.7 adds tcpi_rcv_rtt, tcpi_rcv_space and tcpi_total_retrans to struct tcp_info.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
88675fc9a9
Коммит
b9a178e56c
|
@ -1,3 +1,9 @@
|
|||
Mon May 19 23:13:33 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (inspect_tcp_info): Permit longer data. (glibc
|
||||
2.7 adds tcpi_rcv_rtt, tcpi_rcv_space and tcpi_total_retrans to
|
||||
struct tcp_info.)
|
||||
|
||||
Mon May 19 20:49:07 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (inspect_tcp_info): New function to inspect
|
||||
|
|
|
@ -920,7 +920,8 @@ inspect_tcpi_msec(VALUE ret, const char *prefix, u_int32_t t)
|
|||
static int
|
||||
inspect_tcp_info(int level, int optname, VALUE data, VALUE ret)
|
||||
{
|
||||
if (RSTRING_LEN(data) == sizeof(struct tcp_info)) {
|
||||
size_t actual_size = RSTRING_LEN(data);
|
||||
if (sizeof(struct tcp_info) <= actual_size) {
|
||||
struct tcp_info s;
|
||||
memcpy((char*)&s, RSTRING_PTR(data), sizeof(s));
|
||||
#ifdef HAVE_STRUCT_TCP_INFO_TCPI_STATE
|
||||
|
@ -1063,6 +1064,8 @@ inspect_tcp_info(int level, int optname, VALUE data, VALUE ret)
|
|||
#ifdef HAVE_STRUCT_TCP_INFO_TCPI_SND_ZEROWIN
|
||||
rb_str_catf(ret, " snd_zerowin=%u", s.tcpi_snd_zerowin); /* FreeBSD */
|
||||
#endif
|
||||
if (sizeof(struct tcp_info) < actual_size)
|
||||
rb_str_catf(ret, " (%u bytes too long)", (unsigned)(actual_size - sizeof(struct tcp_info)));
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче