/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-05-boxee2.patch

http://github.com/OpenELEC/OpenELEC.tv · Patch · 90 lines · 81 code · 9 blank · 0 comment · 0 complexity · 566c8cfdd2d07555485aebe2a256150c MD5 · raw file

  1. diff -Naur afpfs-ng-0.8.1/lib/afp.c afpfs-ng-0.8.1.patch/lib/afp.c
  2. --- afpfs-ng-0.8.1/lib/afp.c 2011-09-10 12:14:34.181716631 +0200
  3. +++ afpfs-ng-0.8.1.patch/lib/afp.c 2011-09-10 12:23:15.935726602 +0200
  4. @@ -68,7 +68,7 @@
  5. afp_getsessiontoken_reply,afp_blank_reply, NULL, NULL,
  6. afp_enumerateext2_reply, NULL, NULL, NULL, /*64 - 71 */
  7. afp_listextattrs_reply, NULL, NULL, NULL,
  8. - afp_blank_reply, NULL, NULL, NULL, /*72 - 79 */
  9. + afp_blank_reply, NULL, afp_blank_reply, afp_blank_reply, /*72 - 79 */
  10. NULL, NULL, NULL, NULL,
  11. NULL, NULL, NULL, NULL,
  12. @@ -320,8 +320,16 @@
  13. struct dsi_request * p;
  14. struct afp_server *s2;
  15. +
  16. +
  17. + if (s==NULL)
  18. + goto out;
  19. +
  20. for (p=s->command_requests;p;p=p->next) {
  21. - pthread_cond_signal(&p->condition_cond);
  22. + pthread_mutex_lock(&p->waiting_mutex);
  23. + p->done_waiting=1;
  24. + pthread_cond_signal(&p->waiting_cond);
  25. + pthread_mutex_unlock(&p->waiting_mutex);
  26. }
  27. if (s==server_base) {
  28. @@ -354,7 +362,7 @@
  29. s->exit_flag = 0;
  30. s->path_encoding=kFPUTF8Name; /* This is a default */
  31. s->next=NULL;
  32. - s->bufsize=2048;
  33. + s->bufsize=4096;
  34. s->incoming_buffer=malloc(s->bufsize);
  35. s->attention_quantum=AFP_DEFAULT_ATTENTION_QUANTUM;
  36. @@ -524,13 +532,14 @@
  37. kFPVolCreateDateBit|kFPVolIDBit |
  38. kFPVolNameBit;
  39. char new_encoding;
  40. + int ret;
  41. if (server->using_version->av_number>=30)
  42. bitmap|= kFPVolNameBit|kFPVolBlockSizeBit;
  43. - switch (afp_volopen(volume,bitmap,
  44. - (strlen(volume->volpassword)>0) ? volume->volpassword : NULL))
  45. - {
  46. + ret = afp_volopen(volume,bitmap,
  47. + (strlen(volume->volpassword)>0) ? volume->volpassword : NULL);
  48. + switch(ret){
  49. case kFPAccessDenied:
  50. *l+=snprintf(mesg,max-*l,
  51. "Incorrect volume password\n");
  52. @@ -544,6 +553,10 @@
  53. *l+=snprintf(mesg,max-*l,
  54. "Could not open volume\n");
  55. goto error;
  56. + case ETIMEDOUT:
  57. + *l+=snprintf(mesg,max-*l,
  58. + "Timed out waiting to open volume\n");
  59. + goto error;
  60. }
  61. /* It is said that if a volume's encoding will be the same
  62. @@ -641,7 +654,6 @@
  63. add_server(server);
  64. add_fd_and_signal(server->fd);
  65. -
  66. if (!full) {
  67. return 0;
  68. }
  69. @@ -649,10 +661,13 @@
  70. /* Get the status, and calculate the transmit time. We use this to
  71. * calculate our rx quantum. */
  72. gettimeofday(&t1,NULL);
  73. +
  74. if ((error=dsi_getstatus(server))!=0)
  75. goto error;
  76. gettimeofday(&t2,NULL);
  77. + afp_server_identify(server);
  78. +
  79. if ((t2.tv_sec - t1.tv_sec) > 0)
  80. server->tx_delay= (t2.tv_sec - t1.tv_sec) * 1000;
  81. else