Changeset 1586
- Timestamp:
- Nov 1, 2004, 3:26:32 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/sys/tcpipver.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1585 r1586 160 160 static int TCPNAME(imp_send)(int, const void *, int, int); 161 161 static int TCPNAME(imp_removesocketfromlist)(int); 162 static int TCPNAME(imp_addsockettolist)(int); 162 163 #ifdef TCPV40HDRS 163 164 static int TCPNAME(imp_bsdselect)(int, fd_set *, fd_set *, fd_set *, struct timeval *); … … 228 229 } 229 230 } 230 else if (rc < 0) 231 else if (rc > 0) 232 { 233 /* 234 * Someone is using the socket, we'll remove it from the list of 235 * sockets owned by this process to prevent it from being closed. 236 */ 237 rc = TCPNAME(imp_removesocketfromlist)(pSocketFH->iSocket); 238 if (rc) 239 { 240 LIBC_ASSERTM(!rc, "removesocketfromlist(%d) -> rc=%d sock_errno()->%d\n", pSocketFH->iSocket, rc, TCPNAME(imp_sock_errno)()); 241 rc = -__libc_TcpipGetSocketErrno(); 242 } 243 } 244 else 231 245 rc = -EBADF; 232 246 … … 755 769 LIBCLOG_ENTER("pFH=%p:{iSocket=%d} fh=%d\n", (void *)pFH, ((PLIBCSOCKETFH)pFH)->iSocket, fh); 756 770 PLIBCSOCKETFH pSocketFH = (PLIBCSOCKETFH)pFH; 757 __libc_spmSocketRef(pSocketFH->iSocket); 771 int rc = __libc_spmSocketRef(pSocketFH->iSocket); 772 LIBC_ASSERTM(rc > 0, "__libc_spmSocketDeref(%d) -> rc=%d\n", pSocketFH->iSocket, rc); 758 773 LIBCLOG_RETURN_INT(0); 774 rc = rc; 759 775 } 760 776 … … 823 839 824 840 /* 825 * New: Set usage counter to 1 and remove from tcpip cleanup list.826 * Existing: Increment reference counter 841 * New: Set usage counter to 1. 842 * Existing: Increment reference counter and add to socket list. 827 843 */ 828 844 if (fNew) 829 845 { 830 __libc_spmSocketNew(iSocket);831 TCPNAME(imp_removesocketfromlist)(iSocket); /* We do our own cleanup! */846 rc = __libc_spmSocketNew(iSocket); 847 LIBC_ASSERTM(!rc, "__libc_spmSocketNew(%d) -> rc=%d\n", iSocket, rc); 832 848 } 833 849 else 834 __libc_spmSocketRef(iSocket); 850 { 851 rc = __libc_spmSocketRef(iSocket); 852 LIBC_ASSERTM(rc > 0, "__libc_spmSocketRef(%d) -> rc=%d\n", iSocket, rc); 853 rc = TCPNAME(imp_addsockettolist)(iSocket); 854 LIBC_ASSERTM(!rc, "addsockettolist(%d) -> rc=%d\n", iSocket, rc); 855 } 835 856 LIBCLOG_RETURN_P(pFH); 836 857 } … … 1094 1115 # define ORD_RECV 10 1095 1116 # define ORD_SEND 13 1117 # define ORD_ADDSOCKETTOLIST 27 1096 1118 # define ORD_REMOVESOCKETFROMLIST 28 1097 1119 # define ORD_BSDSELECT 32 … … 1104 1126 # define ORD_RECV 10 1105 1127 # define ORD_SEND 13 1128 # define ORD_ADDSOCKETTOLIST 27 1106 1129 # define ORD_REMOVESOCKETFROMLIST 28 1107 1130 # define ORD_BSDSELECT 32 … … 1213 1236 } 1214 1237 1238 static int TCPNAME(imp_addsockettolist)(int s) 1239 { 1240 static int (*TCPCALL pfn)(int s); 1241 if (!pfn && TCPNAME(get_imp)(ORD_ADDSOCKETTOLIST, (void **)(void *)&pfn)) 1242 return -1; 1243 return pfn(s); 1244 } 1245 1215 1246 static int TCPNAME(imp_removesocketfromlist)(int s) 1216 1247 { … … 1274 1305 if (!rc) 1275 1306 { 1307 /* 1308 * Close the socket, noone needs it. 1309 */ 1276 1310 rc = TCPNAME(imp_soclose)(pFH->iSocket); 1277 1311 LIBC_ASSERTM(!rc, "soclose(%d) -> rc=%d sock_errno()->%d\n", pFH->iSocket, rc, TCPNAME(imp_sock_errno)()); 1312 } 1313 else 1314 { 1315 /* 1316 * If in use by other process, we'll remove it from the list of sockets 1317 * owned by this process to prevent it from begin closed. 1318 */ 1319 rc = TCPNAME(imp_removesocketfromlist)(pFH->iSocket); 1320 LIBC_ASSERTM(!rc, "removesocketfromlist(%d) -> rc=%d sock_errno()->%d\n", pFH->iSocket, rc, TCPNAME(imp_sock_errno)()); 1278 1321 } 1279 1322 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.