File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ impl FileDescription for AnonSocket {
9595 // for read and write.
9696 epoll_ready_events. epollin = true ;
9797 epoll_ready_events. epollout = true ;
98+ // If there is data lost in peer_fd, set EPOLLERR.
99+ if self . peer_lost_data . get ( ) {
100+ epoll_ready_events. epollerr = true ;
101+ }
98102 }
99103 Ok ( epoll_ready_events)
100104 }
@@ -105,6 +109,13 @@ impl FileDescription for AnonSocket {
105109 ecx : & mut MiriInterpCx < ' tcx > ,
106110 ) -> InterpResult < ' tcx , io:: Result < ( ) > > {
107111 if let Some ( peer_fd) = self . peer_fd ( ) . upgrade ( ) {
112+ // If the current readbuf is non-empty when the file description is closed,
113+ // notify the peer that data lost has happened in current file description.
114+ if let Some ( readbuf) = & self . readbuf {
115+ if !readbuf. borrow ( ) . buf . is_empty ( ) {
116+ peer_fd. downcast :: < AnonSocket > ( ) . unwrap ( ) . peer_lost_data . set ( true ) ;
117+ }
118+ }
108119 // Notify peer fd that close has happened, since that can unblock reads and writes.
109120 ecx. check_and_update_readiness ( & peer_fd) ?;
110121 }
You can’t perform that action at this time.
0 commit comments