diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2013-01-07 23:07:13 +0100 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2013-01-07 23:12:43 +0100 |
commit | 59b52325609f16ef7f31d141d1234c345575ddc6 (patch) | |
tree | 3b5450e531762c8a8a584a2aba769238b53eaf8c /main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch | |
parent | f9d6e74ab13741f91ede4875571b2ec75f1f5a15 (diff) | |
download | aports-59b52325609f16ef7f31d141d1234c345575ddc6.tar.bz2 aports-59b52325609f16ef7f31d141d1234c345575ddc6.tar.xz |
testing/afpfs-ng: move to main
Diffstat (limited to 'main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch')
-rw-r--r-- | main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch b/main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch new file mode 100644 index 0000000000..4b7c916da3 --- /dev/null +++ b/main/afpfs-ng/05-afpfs-ng-0.8.1-boxee3.patch @@ -0,0 +1,141 @@ +--- afpfs-ng-0.8.1/lib/dsi.c 2011-08-26 17:27:16.000000000 +0200 ++++ afpfs-ng-0.8.1/lib/dsi.c 2011-08-26 21:33:33.000000000 +0200 +@@ -64,7 +64,7 @@ + rx.size=0; + dsi_setup_header(server,&header,DSI_DSIGetStatus); + /* We're intentionally ignoring the results */ +- ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),20, ++ ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),60, + 0,(void *) &rx); + + free(rx.data); +@@ -197,6 +197,7 @@ + new_request->other=other; + new_request->wait=wait; + new_request->next=NULL; ++ new_request->done_waiting=0; + + pthread_mutex_lock(&server->request_queue_mutex); + if (server->command_requests==NULL) { +@@ -208,7 +209,8 @@ + server->stats.requests_pending++; + pthread_mutex_unlock(&server->request_queue_mutex); + +- pthread_cond_init(&new_request->condition_cond,NULL); ++ pthread_cond_init(&new_request->waiting_cond,NULL); ++ pthread_mutex_init(&new_request->waiting_mutex,NULL); + + if (server->connect_state==SERVER_STATE_DISCONNECTED) { + char mesg[1024]; +@@ -240,16 +242,12 @@ + server->stats.tx_bytes+=size; + pthread_mutex_unlock(&server->send_mutex); + +- int tmpwait=new_request->wait; + #ifdef DEBUG_DSI + printf("=== Waiting for response for %d %s\n", + new_request->requestid, + afp_get_command_name(new_request->subcommand)); + #endif +- if (tmpwait<0) { +- +- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +- pthread_mutex_lock(&mutex); ++ if (new_request->wait<0) { + + /* Wait forever */ + #ifdef DEBUG_DSI +@@ -258,14 +256,17 @@ + afp_get_command_name(new_request->subcommand)); + #endif + +- rc=pthread_cond_wait( +- &new_request->condition_cond, +- &mutex ); +- pthread_mutex_unlock(&mutex); +- +- } else if (tmpwait>0) { +- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +- pthread_mutex_lock(&mutex); ++ pthread_mutex_lock(&new_request->waiting_mutex); ++ ++ if (new_request->done_waiting==0) ++ rc=pthread_cond_wait( ++ &new_request->waiting_cond, ++ &new_request->waiting_mutex ); ++ ++ pthread_mutex_unlock(&new_request->waiting_mutex); ++ ++ } else if (new_request->wait>0) { ++ /* wait for new_request->wait seconds */ + + #ifdef DEBUG_DSI + printf("=== Waiting for %d %s, for %ds\n", +@@ -283,13 +284,15 @@ + printf("=== Changing my mind, no longer waiting for %d\n", + new_request->requestid); + #endif +- pthread_mutex_unlock(&mutex); + goto skip; + } +- rc=pthread_cond_timedwait( +- &new_request->condition_cond, +- &mutex,&ts); +- pthread_mutex_unlock(&mutex); ++ pthread_mutex_lock(&new_request->waiting_mutex); ++ if (new_request->done_waiting==0) ++ rc=pthread_cond_timedwait( ++ &new_request->waiting_cond, ++ &new_request->waiting_mutex,&ts); ++ pthread_mutex_unlock(&new_request->waiting_mutex); ++ + if (rc==ETIMEDOUT) { + /* FIXME: should handle this case properly */ + #ifdef DEBUG_DSI +@@ -299,6 +302,7 @@ + goto out; + } + } else { ++ /* Don't wait */ + #ifdef DEBUG_DSI + printf("=== Skipping wait altogether for %d\n",new_request->requestid); + #endif +@@ -474,7 +478,7 @@ + } + server->flags=ntohs(reply1->flags); + +- p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1)); ++ p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1)); + p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1; + + /* Now work our way through the variable bits */ +@@ -577,6 +581,7 @@ + unsigned char mins=0; + unsigned char checkmessage=0; + ++ memset(mesg,0,AFP_LOGINMESG_LEN); + + /* The logic here's undocumented. If we get an attention packet and + there's no flag, then go check the message. Also, go check the +@@ -757,7 +762,7 @@ + printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read); + #endif + ret = read(server->fd, (void *) +- (((unsigned long) server->incoming_buffer)+server->data_read), ++ (((unsigned int) server->incoming_buffer)+server->data_read), + amount_to_read); + if (ret<0) return -1; + if (ret==0) { +@@ -862,8 +867,11 @@ + #ifdef DEBUG_DSI + printf("<<< Signalling %d, returning %d or %d\n",request->requestid,request->return_code,rc); + #endif ++ pthread_mutex_lock(&request->waiting_mutex); + request->wait=0; +- pthread_cond_signal(&request->condition_cond); ++ request->done_waiting=1; ++ pthread_cond_signal(&request->waiting_cond); ++ pthread_mutex_unlock(&request->waiting_mutex); + } else { + dsi_remove_from_request_queue(server,request); + } |