Guest User

Untitled

a guest
May 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. --- a/src/protocol/bus0/bus.c
  2. +++ b/src/protocol/bus0/bus.c
  3. @@ -297,7 +297,12 @@ bus0_sock_getq_cb(void *arg)
  4. }
  5.  
  6. nni_mtx_lock(&s->mtx);
  7. - lastp = nni_list_last(&s->pipes);
  8. + if (((lastp = nni_list_last(&s->pipes)) != NULL) &&
  9. + (nni_pipe_id(lastp->npipe) == sender)) {
  10. + // If the last pipe in the list is our sender,
  11. + // then ignore it and move to the one just previous.
  12. + lastp = nni_list_prev(&s->pipes, lastp);
  13. + }
  14. NNI_LIST_FOREACH (&s->pipes, p) {
  15. if (nni_pipe_id(p->npipe) == sender) {
  16. continue;
  17. @@ -308,16 +313,14 @@ bus0_sock_getq_cb(void *arg)
  18. }
  19. } else {
  20. dup = msg;
  21. + msg = NULL;
  22. }
  23. if (nni_msgq_tryput(p->sendq, dup) != 0) {
  24. nni_msg_free(dup);
  25. }
  26. }
  27. nni_mtx_unlock(&s->mtx);
  28. -
  29. - if (lastp == NULL) {
  30. - nni_msg_free(msg);
  31. - }
  32. + nni_msg_free(msg);
  33.  
  34. bus0_sock_getq(s);
  35. }
Add Comment
Please, Sign In to add comment