File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -213,16 +213,25 @@ impl Socket {
213213 }
214214 0 => { }
215215 _ => {
216- // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
217- // for POLLHUP rather than read readiness
218- if pollfd. revents & libc:: POLLHUP != 0 {
219- let e = self . take_error ( ) ?. unwrap_or_else ( || {
220- io:: const_io_error!(
221- io:: ErrorKind :: Uncategorized ,
222- "no error set after POLLHUP" ,
223- )
224- } ) ;
225- return Err ( e) ;
216+ if cfg ! ( target_os = "vxworks" ) {
217+ // VxWorks poll does not return POLLHUP or POLLERR in revents. Check if the
218+ // connnection actually succeeded and return ok only when the socket is
219+ // ready and no errors were found.
220+ if let Some ( e) = self . take_error ( ) ? {
221+ return Err ( e) ;
222+ }
223+ } else {
224+ // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
225+ // for POLLHUP or POLLERR rather than read readiness
226+ if pollfd. revents & ( libc:: POLLHUP | libc:: POLLERR ) != 0 {
227+ let e = self . take_error ( ) ?. unwrap_or_else ( || {
228+ io:: const_io_error!(
229+ io:: ErrorKind :: Uncategorized ,
230+ "no error set after POLLHUP" ,
231+ )
232+ } ) ;
233+ return Err ( e) ;
234+ }
226235 }
227236
228237 return Ok ( ( ) ) ;
You can’t perform that action at this time.
0 commit comments