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.3 by root, Sun Sep 2 12:23:03 2001 UTC vs.
Revision 1.4 by root, Wed Sep 12 16:45:59 2001 UTC

170sub getpeername { getpeername tied(${$_[0]})->[0] } 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 ($fh, $peername) pair (or nothing).
176 176
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]})->[0] 182 $peername = accept $fh, tied(${$_[0]})->[0]
183 and return ($peername, $fh = new_from_fh Coro::Socket $fh); 183 and return wantarray
184 ? ((new_from_fh Coro::Socket $fh), $peername),
185 : (new_from_fh Coro::Socket $fh);
184 186
185 return unless $!{EAGAIN}; 187 return unless $!{EAGAIN};
186 188
187 $_[0]->readable or return; 189 $_[0]->readable or return;
188 } 190 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines