ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Event/Socket.pm
(Generate patch)

Comparing Coro/Event/Socket.pm (file contents):
Revision 1.2 by root, Sat Aug 25 15:42:02 2001 UTC vs.
Revision 1.3 by root, Sun Sep 2 12:23:03 2001 UTC

157Do the same thing as the perl builtins (but return true on 157Do the same thing as the perl builtins (but return true on
158EINPROGRESS). Remember that these must be method calls. 158EINPROGRESS). Remember that these must be method calls.
159 159
160=cut 160=cut
161 161
162sub connect { connect tied(${$_[0]})->{fh}, $_[1] or $! == Errno::EINPROGRESS } 162sub connect { connect tied(${$_[0]})->[0], $_[1] or $! == Errno::EINPROGRESS }
163sub bind { bind tied(${$_[0]})->{fh}, $_[1] } 163sub bind { bind tied(${$_[0]})->[0], $_[1] }
164sub listen { listen tied(${$_[0]})->{fh}, $_[1] } 164sub listen { listen tied(${$_[0]})->[0], $_[1] }
165sub getsockopt { getsockopt tied(${$_[0]})->{fh}, $_[1], $_[2] } 165sub getsockopt { getsockopt tied(${$_[0]})->[0], $_[1], $_[2] }
166sub setsockopt { setsockopt tied(${$_[0]})->{fh}, $_[1], $_[2], $_[3] } 166sub setsockopt { setsockopt tied(${$_[0]})->[0], $_[1], $_[2], $_[3] }
167sub send { send tied(${$_[0]})->{fh}, $_[1], $_[2], @_ > 2 ? $_[3] : () } 167sub send { send tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () }
168sub recv { recv tied(${$_[0]})->{fh}, $_[1], $_[2], @_ > 2 ? $_[3] : () } 168sub recv { recv tied(${$_[0]})->[0], $_[1], $_[2], @_ > 2 ? $_[3] : () }
169sub getsockname { getsockname tied(${$_[0]})->{fh} } 169sub getsockname { getsockname tied(${$_[0]})->[0] }
170sub getpeername { getpeername tied(${$_[0]})->{fh} } 170sub getpeername { getpeername tied(${$_[0]})->[0] }
171 171
172=item ($peername, $fh) = $listen_fh->accept 172=item ($peername, $fh) = $listen_fh->accept
173 173
174In scalar context, returns the newly accepted socket (or undef) and in 174In scalar context, returns the newly accepted socket (or undef) and in
175list context return the ($peername, $fh) pair (or nothing). 175list context return the ($peername, $fh) pair (or nothing).
177=cut 177=cut
178 178
179sub accept { 179sub accept {
180 my ($peername, $fh); 180 my ($peername, $fh);
181 while () { 181 while () {
182 $peername = accept $fh, tied(${$_[0]})->{fh} 182 $peername = accept $fh, tied(${$_[0]})->[0]
183 and return ($peername, $fh = new_from_fh Coro::Socket $fh); 183 and return ($peername, $fh = new_from_fh Coro::Socket $fh);
184 184
185 return unless $!{EAGAIN}; 185 return unless $!{EAGAIN};
186 186
187 $_[0]->readable or return; 187 $_[0]->readable or return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines