mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_fdcopy): New. This can copy even though
fdset size exceed FD_SETSIZE. * include/ruby/intern.h (rb_fd_copy): use rb_w32_fdcopy() git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3c68095b8a
commit
04202dc83d
3 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Sat Apr 30 23:10:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* win32/win32.c (rb_w32_fdcopy): New. This can copy even though
|
||||
fdset size exceed FD_SETSIZE.
|
||||
* include/ruby/intern.h (rb_fd_copy): use rb_w32_fdcopy()
|
||||
|
||||
Sat Apr 30 20:18:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread.c (do_select): Change arugment type to rb_fdset_t.
|
||||
|
|
|
@ -269,7 +269,7 @@ void rb_fd_term(rb_fdset_t *);
|
|||
void rb_fd_set(int, rb_fdset_t *);
|
||||
#define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
|
||||
#define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
|
||||
#define rb_fd_copy(d, s) *((d)->fdset) = *((s)->fdset)
|
||||
#define rb_fd_copy(d, s) rb_w32_fdcopy((d), (s))
|
||||
#define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select((n), (rfds) ? ((rb_fdset_t*)(rfds))->fdset : NULL, (wfds) ? ((rb_fdset_t*)(wfds))->fdset : NULL, (efds) ? ((rb_fdset_t*)(efds))->fdset: NULL, (timeout))
|
||||
#define rb_fd_resize(n, f) ((void)(f))
|
||||
|
||||
|
|
|
@ -2366,6 +2366,18 @@ rb_w32_fdisset(int fd, fd_set *set)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
rb_w32_fdcopy(rb_fdset_t *dst, const rb_fdset_t *src)
|
||||
{
|
||||
if (dst->capa < src->fdset->fd_count) {
|
||||
dst->capa = (src->fdset->fd_count / FD_SETSIZE + 1) * FD_SETSIZE;
|
||||
dst->fdset = xrealloc(dst->fdset, sizeof(unsigned int) + sizeof(SOCKET) * dst->capa);
|
||||
}
|
||||
|
||||
memcpy(dst->fdset->fd_array, src->fdset->fd_array,
|
||||
src->fdset->fd_count * sizeof(src->fdset->fd_array[0]));
|
||||
}
|
||||
|
||||
//
|
||||
// Networking trampolines
|
||||
// These are used to avoid socket startup/shutdown overhead in case
|
||||
|
|
Loading…
Add table
Reference in a new issue