diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
commit | 758cb647c7ac9e02a9ee0d7cb0934a5c963481e0 (patch) | |
tree | a6ad21b14e176e9c3a39a775781b978950315543 /ext/socket/socket.c | |
parent | d426749ff0ec0348e8b2f9e32724ac715aad500b (diff) | |
download | ruby-758cb647c7ac9e02a9ee0d7cb0934a5c963481e0.tar.gz |
19991004
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 3ff6af441e..f7840948f8 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -780,6 +780,20 @@ socks_s_open(class, host, serv) Check_SafeStr(host); return open_inet(class, host, serv, INET_SOCKS); } + +#ifdef SOCKS5 +static VALUE +socks_s_close(sock) + VALUE sock; +{ + OpenFile *fptr; + + GetOpenFile(sock, fptr); + shutdown(fileno(fptr->f), 2); + shutdown(fileno(fptr->f2), 2); + return rb_io_close(sock); +} +#endif #endif /* @@ -1876,6 +1890,9 @@ Init_socket() rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket); rb_define_singleton_method(rb_cSOCKSSocket, "open", socks_s_open, 2); rb_define_singleton_method(rb_cSOCKSSocket, "new", socks_s_open, 2); +#ifdef SOCKS5 + rb_define_method(rb_cSOCKSSocket, "close", socks_s_close, 0); +#endif #endif rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket); |