Cygwin: fhandler_socket: Move select functions into derived classes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
479080baec
commit
b8a57a2d2a
|
@ -625,13 +625,15 @@ class fhandler_socket: public fhandler_base
|
|||
|
||||
void hclose (HANDLE) {close ();}
|
||||
|
||||
select_record *select_read (select_stuff *);
|
||||
select_record *select_write (select_stuff *);
|
||||
select_record *select_except (select_stuff *);
|
||||
void set_addr_family (int af) {addr_family = af;}
|
||||
int get_addr_family () {return addr_family;}
|
||||
void set_socket_type (int st) { type = st;}
|
||||
int get_socket_type () {return type;}
|
||||
|
||||
/* select.cc */
|
||||
virtual select_record *select_read (select_stuff *) = 0;
|
||||
virtual select_record *select_write (select_stuff *) = 0;
|
||||
virtual select_record *select_except (select_stuff *) = 0;
|
||||
};
|
||||
|
||||
class fhandler_socket_inet: public fhandler_socket
|
||||
|
@ -674,6 +676,11 @@ class fhandler_socket_inet: public fhandler_socket
|
|||
int ioctl (unsigned int cmd, void *);
|
||||
int fcntl (int cmd, intptr_t);
|
||||
|
||||
/* select.cc */
|
||||
select_record *select_read (select_stuff *);
|
||||
select_record *select_write (select_stuff *);
|
||||
select_record *select_except (select_stuff *);
|
||||
|
||||
/* from here on: CLONING */
|
||||
fhandler_socket_inet (void *) {}
|
||||
|
||||
|
@ -772,6 +779,11 @@ class fhandler_socket_local: public fhandler_socket
|
|||
int __reg3 facl (int, int, struct acl *);
|
||||
int __reg2 link (const char *);
|
||||
|
||||
/* select.cc */
|
||||
select_record *select_read (select_stuff *);
|
||||
select_record *select_write (select_stuff *);
|
||||
select_record *select_except (select_stuff *);
|
||||
|
||||
/* from here on: CLONING */
|
||||
fhandler_socket_local (void *) {}
|
||||
|
||||
|
|
|
@ -1549,7 +1549,7 @@ socket_cleanup (select_record *, select_stuff *stuff)
|
|||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket::select_read (select_stuff *ss)
|
||||
fhandler_socket_inet::select_read (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
|
@ -1565,7 +1565,7 @@ fhandler_socket::select_read (select_stuff *ss)
|
|||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket::select_write (select_stuff *ss)
|
||||
fhandler_socket_inet::select_write (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
|
@ -1586,7 +1586,61 @@ fhandler_socket::select_write (select_stuff *ss)
|
|||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket::select_except (select_stuff *ss)
|
||||
fhandler_socket_inet::select_except (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
{
|
||||
s->startup = start_thread_socket;
|
||||
s->verify = verify_true;
|
||||
s->cleanup = socket_cleanup;
|
||||
}
|
||||
s->peek = peek_socket;
|
||||
/* FIXME: Is this right? Should these be used as criteria for except? */
|
||||
s->except_ready = saw_shutdown_write () || saw_shutdown_read ();
|
||||
s->except_selected = true;
|
||||
return s;
|
||||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket_local::select_read (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
{
|
||||
s->startup = start_thread_socket;
|
||||
s->verify = verify_true;
|
||||
s->cleanup = socket_cleanup;
|
||||
}
|
||||
s->peek = peek_socket;
|
||||
s->read_ready = saw_shutdown_read ();
|
||||
s->read_selected = true;
|
||||
return s;
|
||||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket_local::select_write (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
{
|
||||
s->startup = start_thread_socket;
|
||||
s->verify = verify_true;
|
||||
s->cleanup = socket_cleanup;
|
||||
}
|
||||
s->peek = peek_socket;
|
||||
s->write_ready = saw_shutdown_write () || connect_state () == unconnected;
|
||||
s->write_selected = true;
|
||||
if (connect_state () != unconnected)
|
||||
{
|
||||
s->except_ready = saw_shutdown_write () || saw_shutdown_read ();
|
||||
s->except_on_write = true;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
select_record *
|
||||
fhandler_socket_local::select_except (select_stuff *ss)
|
||||
{
|
||||
select_record *s = ss->start.next;
|
||||
if (!s->startup)
|
||||
|
|
Loading…
Reference in New Issue