- Timestamp:
- Feb 1, 2009 8:42:38 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/debug.c
r16443 r16445 250 250 251 251 AssertReturn(strcmp(pszType, "natsock") == 0, 0); 252 if (so == NULL) 253 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket is null"); 252 254 if (so->so_state == SS_NOFDREF || so->s == -1) 253 255 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket SS_NODREF"); -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r16443 r16445 692 692 if (so->so_expire <= curtime) 693 693 { 694 QSOCKET_LOCK(udb); 695 #ifdef VBOX_WITH_SLIRP_MT 696 /*we can determinate the next item after udb_detach*/ 697 if (so->so_next != &tcb) 698 { 699 SOCKET_LOCK(so->so_next); 700 so_next = so->so_next; 701 } 702 #endif 703 QSOCKET_UNLOCK(udb); 694 704 udp_detach(pData, so); 695 705 CONTINUE_NO_UNLOCK(udp); -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r16443 r16445 287 287 do { \ 288 288 int rc; \ 289 rc = RTCritSectEnter(&_X(queue) ## _mutex); \ 289 /* Assert(strcmp(RTThreadSelfName(), "EMT") != 0); */ \ 290 rc = RTCritSectEnter(&_X(queue) ## _mutex); \ 290 291 AssertReleaseRC(rc); \ 291 292 } while (0) … … 311 312 QSOCKET_LOCK(__X(queue_## label ## _label)); \ 312 313 (so) = (_X(queue_ ## label ## _label)).so_next; \ 314 QSOCKET_UNLOCK(__X(queue_## label ##_label)); \ 313 315 if ((so) != &(_X(queue_## label ## _label))) SOCKET_LOCK((so)); \ 314 316 for(;;) \ … … 316 318 if ((so) == &(_X(queue_## label ## _label))) \ 317 319 { \ 318 QSOCKET_UNLOCK(__X(queue_## label ##_label)); \319 320 break; \ 320 321 } \ 321 Log2(("%s:%d Processing so:%R[natsock]\n", __FUNCTION__, __LINE__, (so))); \ 322 if ((so)->so_next != &(_X(queue_## label ## _label))) \ 323 { \ 324 SOCKET_LOCK((so)->so_next); \ 325 } \ 326 (sonext) = (so)->so_next; \ 327 QSOCKET_UNLOCK(__X(queue_## label ##_label)); 322 Log2(("%s:%d Processing so:%R[natsock]\n", __FUNCTION__, __LINE__, (so))); 328 323 329 324 # define CONTINUE_NO_UNLOCK(label) goto loop_end_ ## label ## _mt_nounlock 330 325 # define CONTINUE(label) goto loop_end_ ## label ## _mt 331 326 /* @todo replace queue parameter with macrodinition */ 327 /* _mt_nounlock - user should lock so_next before calling CONTINUE_NO_UNLOCK */ 332 328 # define LOOP_LABEL(label, so, sonext) loop_end_ ## label ## _mt: \ 329 (sonext) = (so)->so_next; \ 333 330 SOCKET_UNLOCK(so); \ 331 QSOCKET_LOCK(_X(queue_ ## label ## _label)); \ 332 if ((sonext) != &(_X(queue_## label ## _label))) \ 333 { \ 334 SOCKET_LOCK((sonext)); \ 335 QSOCKET_UNLOCK(_X(queue_ ## label ## _label)); \ 336 } \ 337 else \ 338 { \ 339 so = &_X(queue_ ## label ## _label); \ 340 QSOCKET_UNLOCK(_X(queue_ ## label ## _label)); \ 341 break; \ 342 } \ 343 (so) = (sonext); \ 344 continue; \ 334 345 loop_end_ ## label ## _mt_nounlock: \ 335 QSOCKET_LOCK(_X(queue_ ## label ## _label)); \336 346 (so) = (sonext) 337 347 338 348 #define DO_TCP_OUTPUT(data, sotcb) \ 339 349 do { \ -
trunk/src/VBox/Devices/Network/slirp/socket.c
r16443 r16445 78 78 sofree(PNATState pData, struct socket *so) 79 79 { 80 struct socket *so_prev = NULL; 80 81 if (so == tcp_last_so) 81 82 tcp_last_so = &tcb; … … 86 87 if (so->so_m != NULL) 87 88 m_free(pData, so->so_m); 88 89 89 if(so->so_next && so->so_prev) 90 { 91 if ( so->so_prev != NULL 92 && so->so_prev != &udb 93 && so->so_prev != &tcb) 94 { 95 SOCKET_LOCK(so->so_prev); 96 so_prev = so->so_prev; 97 } 90 98 remque(pData, so); /* crashes if so is not in a queue */ 99 if (so_prev != NULL) 100 SOCKET_UNLOCK(so_prev); 101 } 91 102 so->so_state = SS_NOFDREF; /* for debugging purposes */ 92 103 SOCKET_UNLOCK(so); … … 744 755 745 756 so->s = s; 757 SOCKET_UNLOCK(so); 746 758 return so; 747 759 } -
trunk/src/VBox/Devices/Network/slirp/socket.h
r16443 r16445 76 76 do { \ 77 77 int rc; \ 78 /* Assert(strcmp(RTThreadSelfName(), "EMT") != 0); */ \ 78 79 Log2(("lock:%s:%d L on %R[natsock]\n", __FUNCTION__, __LINE__, (so))); \ 80 Assert(!RTCritSectIsOwner(&(so)->so_mutex)); \ 79 81 rc = RTCritSectEnter(&(so)->so_mutex); \ 80 82 AssertReleaseRC(rc); \ -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r16443 r16445 425 425 && so->so_fport == ti->ti_dport) 426 426 { 427 if (sonxt != &tcb)428 SOCKET_UNLOCK(sonxt);429 427 Log2(("lock: %s:%d We found socket %R[natsock]\n", __FUNCTION__, __LINE__, so)); 430 428 break; /* so is locked here */ … … 462 460 * as if it was LISTENING, and continue... 463 461 */ 464 Log2(("so = % p\n", so));462 Log2(("so = %R[natsock]\n", so)); 465 463 if (so == 0) 466 464 {
Note:
See TracChangeset
for help on using the changeset viewer.