- Timestamp:
- Oct 17, 2016 1:55:11 PM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r63676 r64298 363 363 { 364 364 int fUninitializedTemplate = 0; 365 int shuterr; 366 365 367 fUninitializedTemplate = RT_BOOL(( sototcpcb(so) 366 368 && ( sototcpcb(so)->t_template.ti_src.s_addr == INADDR_ANY … … 369 371 Log2(("%s: disconnected, nn = %d, errno = %d (%s)\n", 370 372 RT_GCC_EXTENSION __PRETTY_FUNCTION__, nn, sockerr, strerror(sockerr))); 371 sofcantrcvmore(so); 372 if (!fUninitializedTemplate) 373 374 shuterr = sofcantrcvmore(so); 375 if (!sockerr && !shuterr && !fUninitializedTemplate) 373 376 tcp_sockclosed(pData, sototcpcb(so)); 374 377 else … … 1101 1104 } 1102 1105 1103 void 1106 int 1104 1107 sofcantrcvmore(struct socket *so) 1105 1108 { 1109 int err = 0; 1110 1106 1111 LogFlowFunc(("ENTER: so:%R[natsock]\n", so)); 1107 1112 if ((so->so_state & SS_NOFDREF) == 0) 1108 1113 { 1109 shutdown(so->s, 0); 1114 /* 1115 * If remote closes first and then sends an RST, the recv() in 1116 * soread() will keep reporting EOF without any error 1117 * indication, so we must also check if shutdown() succeeds 1118 * here. 1119 */ 1120 int status = shutdown(so->s, 0); 1121 if (status < 0) 1122 err = errno; 1110 1123 } 1111 1124 so->so_state &= ~(SS_ISFCONNECTING); 1112 1125 if (so->so_state & SS_FCANTSENDMORE) 1126 { 1127 /* 1128 * If we have closed first, and remote closes, shutdown will 1129 * return ENOTCONN, but this is expected. Don't tell the 1130 * caller there was an error. 1131 */ 1132 if (err == ENOTCONN) 1133 err = 0; 1113 1134 so->so_state = SS_NOFDREF; /* Don't select it */ 1114 1135 /* XXX close() here as well? */ 1136 } 1115 1137 else 1116 1138 so->so_state |= SS_FCANTRCVMORE; 1117 LogFlowFuncLeave(); 1139 1140 LogFlowFunc(("LEAVE: %d\n", err)); 1141 return err; 1118 1142 } 1119 1143 -
trunk/src/VBox/Devices/Network/slirp/socket.h
r62511 r64298 182 182 void soisfconnecting (register struct socket *); 183 183 void soisfconnected (register struct socket *); 184 voidsofcantrcvmore (struct socket *);184 int sofcantrcvmore (struct socket *); 185 185 void sofcantsendmore (struct socket *); 186 186 void soisfdisconnected (struct socket *);
Note:
See TracChangeset
for help on using the changeset viewer.