summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2009-01-15 23:01:36 +0000
committerDirk Engling <erdgeist@erdgeist.org>2009-01-15 23:01:36 +0000
commit0987307ea38f88318d622c1e089ac678d3279358 (patch)
tree12a2b38528994bac138eb10e86a10fcbee79d2cf /ot_mutex.c
parent83d62ba0fb44a1dcf1daadf2633c0e37c050bc49 (diff)
downloadopentracker-0987307ea38f88318d622c1e089ac678d3279358.tar.gz
opentracker-0987307ea38f88318d622c1e089ac678d3279358.zip
Add comments, rename our struct http_data h to cookie, all clientsockets to sock, all size_t from socket_recvs to byte_count. Make signal handler set default handler for the second SIGINT
Diffstat (limited to 'ot_mutex.c')
-rw-r--r--ot_mutex.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ot_mutex.c b/ot_mutex.c
index 341eafd..e465496 100644
--- a/ot_mutex.c
+++ b/ot_mutex.c
@@ -113,7 +113,7 @@ size_t mutex_get_torrent_count( ) {
struct ot_task {
ot_taskid taskid;
ot_tasktype tasktype;
- int64 socket;
+ int64 sock;
int iovec_entries;
struct iovec *iovec;
struct ot_task *next;
@@ -124,7 +124,7 @@ static struct ot_task *tasklist = NULL;
static pthread_mutex_t tasklist_mutex;
static pthread_cond_t tasklist_being_filled;
-int mutex_workqueue_pushtask( int64 socket, ot_tasktype tasktype ) {
+int mutex_workqueue_pushtask( int64 sock, ot_tasktype tasktype ) {
struct ot_task ** tmptask, * task;
/* Want exclusive access to tasklist */
@@ -148,7 +148,7 @@ int mutex_workqueue_pushtask( int64 socket, ot_tasktype tasktype ) {
task->taskid = 0;
task->tasktype = tasktype;
- task->socket = socket;
+ task->sock = sock;
task->iovec_entries = 0;
task->iovec = NULL;
task->next = 0;
@@ -162,7 +162,7 @@ int mutex_workqueue_pushtask( int64 socket, ot_tasktype tasktype ) {
return 0;
}
-void mutex_workqueue_canceltask( int64 socket ) {
+void mutex_workqueue_canceltask( int64 sock ) {
struct ot_task ** task;
/* Want exclusive access to tasklist */
@@ -171,10 +171,10 @@ void mutex_workqueue_canceltask( int64 socket ) {
MTX_DBG( "canceltask locked.\n" );
task = &tasklist;
- while( *task && ( (*task)->socket != socket ) )
+ while( *task && ( (*task)->sock != sock ) )
*task = (*task)->next;
- if( *task && ( (*task)->socket == socket ) ) {
+ if( *task && ( (*task)->sock == sock ) ) {
struct iovec *iovec = (*task)->iovec;
struct ot_task *ptask = *task;
int i;
@@ -281,7 +281,7 @@ int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iove
int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) {
struct ot_task ** task;
- int64 socket = -1;
+ int64 sock = -1;
/* Want exclusive access to tasklist */
MTX_DBG( "popresult locks.\n" );
@@ -297,7 +297,7 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) {
*iovec_entries = (*task)->iovec_entries;
*iovec = (*task)->iovec;
- socket = (*task)->socket;
+ sock = (*task)->sock;
*task = (*task)->next;
free( ptask );
@@ -307,7 +307,7 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) {
MTX_DBG( "popresult unlocks.\n" );
pthread_mutex_unlock( &tasklist_mutex );
MTX_DBG( "popresult unlocked.\n" );
- return socket;
+ return sock;
}
void mutex_init( ) {
@@ -326,4 +326,4 @@ void mutex_deinit( ) {
byte_zero( all_torrents, sizeof( all_torrents ) );
}
-const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.18 $\n";
+const char *g_version_mutex_c = "$Source: /home/cvsroot/opentracker/ot_mutex.c,v $: $Revision: 1.19 $\n";