- Timestamp:
- Apr 1, 2025 8:30:27 PM (2 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168262
- Location:
- trunk/src/libs/libslirp-4.8.0/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/libslirp-4.8.0/src/nathandletable.c
r105667 r108816 49 49 } 50 50 51 Log6Func(("Looking up %d on %p\n", fd, (void *)pNATHandleTable));52 51 SOCKET s = (SOCKET)RTHandleTableLookup(*pNATHandleTable, fd); 52 Log6Func(("Looked up %d on %p and returned %d\n", fd, (void *)pNATHandleTable, s)); 53 53 return s; 54 54 } … … 63 63 } 64 64 65 Log6Func(("Creating sock %llu on %p\n", uSocket, (void *)pNATHandleTable)); 66 return RTHandleTableAlloc(*pNATHandleTable, (void *)uSocket, pHandle); 65 int ret = RTHandleTableAlloc(*pNATHandleTable, (void *)uSocket, pHandle); 66 Log6Func(("Creating sock %llu on %p with handle %d\n", uSocket, (void *)pNATHandleTable, *pHandle)); 67 return ret; 68 } 69 70 int libslirp_wrap_RTHandleTableFree(int fd) 71 { 72 if (pNATHandleTable == NULL) 73 return VERR_INVALID_PARAMETER; 74 75 void *ret = RTHandleTableFree(*pNATHandleTable, fd); 76 Log6Func(("Freeing sock %d on %p\n", fd, (void *)pNATHandleTable)); 77 if (ret) 78 return VINF_SUCCESS; 79 80 return VERR_INVALID_PARAMETER; 67 81 } 68 82 -
trunk/src/libs/libslirp-4.8.0/src/nathandletable.h
r105667 r108816 59 59 extern PRTHANDLETABLE pNATHandleTable; 60 60 61 /** 62 * Looks up a SOCKET handle by the integer handle used by libslirp. 63 * 64 * @returns actual SOCKET handle used by Windows 65 * @param fd Integer handle used internally by libslirp. 66 */ 61 67 SOCKET libslirp_wrap_RTHandleTableLookup(int fd); 62 68 63 int libslirp_wrap_RTHandleTableAlloc(SOCKET, uint32_t *); 69 /** 70 * Allocates an integer handle from a SOCKET handle for use libslirp. 71 * 72 * @returns VBox status code 73 * @param s SOCKET handle from Windows. 74 * Typically from a socket() call. 75 * @param h Return param. Integer handle from table. 76 */ 77 int libslirp_wrap_RTHandleTableAlloc(SOCKET s, uint32_t *h); 78 79 /** 80 * Frees entry from lookup table. 81 * 82 * @returns VBox status code 83 * @param fd Integer handle used internally by libslirp. 84 */ 85 int libslirp_wrap_RTHandleTableFree(int fd); 64 86 65 87 #ifdef __cplusplus -
trunk/src/libs/libslirp-4.8.0/src/util.c
r105533 r108816 199 199 200 200 ret = closesocket(s); 201 202 if (ret == SOCKET_ERROR) 203 { 204 int iError = WSAGetLastError(); 205 LogFunc(("SOCKET CLOSE ERROR: Handle %d, discovered to be SOCKET %d, \ 206 failed to close with error: %d\n", fd, s, iError)); 207 return ret; 208 } 209 210 ret = libslirp_wrap_RTHandleTableFree(fd); 211 if (!RT_SUCCESS(ret)) 212 { 213 Log3Func(("Handle free error: Handle %d which was really %d", fd, s)); 214 return VERR_INVALID_PARAMETER; 215 } 201 216 #else 202 217 ret = closesocket(fd); 203 #endif 204 if (ret < 0) {205 errno = socket_error();206 } 218 if (ret < 0) { 219 errno = socket_error(); 220 } 221 #endif 207 222 return ret; 208 223 }
Note:
See TracChangeset
for help on using the changeset viewer.