mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/socket.c (init_sock): no need for special finalizer,
socket descriptor is no longer duplicated in 1.7. [ruby-talk:50732] * win32/win32.c, win32/win32.h (rb_w32_fddup, rb_w32_fdclose): delete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e4f26da2d9
commit
c691d09dc1
4 changed files with 9 additions and 44 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Oct 1 23:48:32 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* ext/socket/socket.c (init_sock): no need for special finalizer,
|
||||
socket descriptor is no longer duplicated in 1.7.
|
||||
[ruby-talk:50732]
|
||||
|
||||
* win32/win32.c, win32/win32.h (rb_w32_fddup, rb_w32_fdclose):
|
||||
delete.
|
||||
|
||||
Mon Sep 30 20:29:10 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* io.c (rb_io_inspect): not need to raise IOError for closed
|
||||
|
|
|
@ -163,23 +163,6 @@ ruby_getaddrinfo(nodename, servname, hints, res)
|
|||
#define close closesocket
|
||||
#endif
|
||||
|
||||
#ifdef NT
|
||||
static void sock_finalize _((OpenFile *fptr));
|
||||
|
||||
static void
|
||||
sock_finalize(fptr)
|
||||
OpenFile *fptr;
|
||||
{
|
||||
SOCKET s;
|
||||
|
||||
if (!fptr->f) return;
|
||||
s = get_osfhandle(fileno(fptr->f));
|
||||
rb_w32_fdclose(fptr->f);
|
||||
if (fptr->f2) rb_w32_fdclose(fptr->f2);
|
||||
closesocket(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
init_sock(sock, fd)
|
||||
VALUE sock;
|
||||
|
@ -189,9 +172,6 @@ init_sock(sock, fd)
|
|||
|
||||
MakeOpenFile(sock, fp);
|
||||
fp->f = rb_fdopen(fd, "r");
|
||||
#ifdef NT
|
||||
fp->finalize = sock_finalize;
|
||||
#endif
|
||||
fp->f2 = rb_fdopen(fd, "w");
|
||||
fp->mode = FMODE_READWRITE;
|
||||
rb_io_synchronized(fp);
|
||||
|
|
|
@ -1472,28 +1472,6 @@ is_socket(SOCKET fd)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
rb_w32_fddup (int fd)
|
||||
{
|
||||
SOCKET s = TO_SOCKET(fd);
|
||||
|
||||
if (s == -1)
|
||||
return -1;
|
||||
|
||||
RUBY_CRITICAL(fd = rb_w32_open_osfhandle(s, O_RDWR|O_BINARY));
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rb_w32_fdclose(FILE *fp)
|
||||
{
|
||||
RUBY_CRITICAL({
|
||||
STHREAD_ONLY(_free_osfhnd(fileno(fp)));
|
||||
fclose(fp);
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Since the errors returned by the socket error function
|
||||
// WSAGetLastError() are not known by the library routine strerror
|
||||
|
|
|
@ -161,8 +161,6 @@ extern char * NtGetLib(void);
|
|||
extern char * NtGetBin(void);
|
||||
extern pid_t pipe_exec(char *, int, FILE **, FILE **);
|
||||
extern int flock(int fd, int oper);
|
||||
extern int rb_w32_fddup(int);
|
||||
extern void rb_w32_fdclose(FILE *);
|
||||
extern int rb_w32_accept(int, struct sockaddr *, int *);
|
||||
extern int rb_w32_bind(int, struct sockaddr *, int);
|
||||
extern int rb_w32_connect(int, struct sockaddr *, int);
|
||||
|
|
Loading…
Reference in a new issue