Browse Source

remove debug fprintfs used to catch a bug

master
Dirk Engling 9 months ago
parent
commit
6ae819ae10
  1. 9
      opentracker.c
  2. 6
      ot_http.c
  3. 13
      ot_mutex.c

9
opentracker.c

@ -217,11 +217,9 @@ static void handle_write( const int64 sock ) { @@ -217,11 +217,9 @@ static void handle_write( const int64 sock ) {
chunked = 1;
for( i = 0; i < cookie->batches; ++i ) {
fprintf(stderr, "handle_write inspects batch %zu of %zu (bytes left: %llu)\n", i, cookie->batches, cookie->batch[i].bytesleft);
if( cookie->batch[i].bytesleft ) {
int64 res = iob_send( sock, cookie->batch + i );
fprintf(stderr, "handle_write yields res %lld when trying to iob_send\n", res);
if( res == -3 ) {
handle_dead( sock );
return;
@ -237,14 +235,11 @@ static void handle_write( const int64 sock ) { @@ -237,14 +235,11 @@ static void handle_write( const int64 sock ) {
}
/* In a chunked transfer after all batches accumulated have been sent, wait for the next one */
if( chunked ) {
fprintf( stderr, "handle_write is STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER => dont want write on sock %lld\n", sock);
if( chunked )
io_dontwantwrite( sock );
} else {
fprintf( stderr, "handle_write is STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER => handle dead on sock %lld\n", sock);
else
handle_dead( sock );
}
}
static void handle_accept( const int64 serversocket ) {
struct http_data *cookie;

6
ot_http.c

@ -144,8 +144,6 @@ ssize_t http_sendiovecdata( const int64 sock, struct ot_workstruct *ws, int iove @@ -144,8 +144,6 @@ ssize_t http_sendiovecdata( const int64 sock, struct ot_workstruct *ws, int iove
cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK;
}
fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch == %p\n", iovec_entries, cookie->batch);
if( iovec_entries ) {
if( cookie->flag & STRUCT_HTTP_FLAG_GZIP )
@ -184,7 +182,6 @@ fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch @@ -184,7 +182,6 @@ fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch
for( i=0; i<iovec_entries; ++i ) {
/* If the current batch's limit is reached, try to reallocate a new batch to work on */
if( current->bytesleft > OT_BATCH_LIMIT ) {
fprintf(stderr, "http_sendiovecdata found batch above limit: %llu\n", current->bytesleft);
io_batch * new_batch = realloc( cookie->batch, (cookie->batches + 1) * sizeof(io_batch) );
if( new_batch ) {
cookie->batch = new_batch;
@ -192,7 +189,6 @@ fprintf(stderr, "http_sendiovecdata found batch above limit: %llu\n", current->b @@ -192,7 +189,6 @@ fprintf(stderr, "http_sendiovecdata found batch above limit: %llu\n", current->b
iob_init_autofree(current ,0);
}
}
fprintf(stderr, "http_sendiovecdata calling iob_addbuf_free with %zd\n", iovector[i].iov_len);
iob_addbuf_free( current, iovector[i].iov_base, iovector[i].iov_len );
}
free( iovector );
@ -201,7 +197,6 @@ fprintf(stderr, "http_sendiovecdata calling iob_addbuf_free with %zd\n", iovecto @@ -201,7 +197,6 @@ fprintf(stderr, "http_sendiovecdata calling iob_addbuf_free with %zd\n", iovecto
}
if ((cookie->flag & STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER) && cookie->batch && !is_partial) {
fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n");
current = cookie->batch + cookie->batches - 1;
iob_addbuf(current, "0\r\n\r\n", 5);
cookie->flag &= ~STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER;
@ -210,7 +205,6 @@ fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n" @@ -210,7 +205,6 @@ fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n"
/* writeable sockets timeout after 10 minutes */
taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND );
io_timeout( sock, t );
fprintf (stderr, "http_sendiovecdata marks socket %lld as wantwrite\n", sock);
io_wantwrite( sock );
return 0;
}

13
ot_mutex.c

@ -205,14 +205,12 @@ int mutex_workqueue_pushchunked(ot_taskid taskid, struct iovec *iovec) { @@ -205,14 +205,12 @@ int mutex_workqueue_pushchunked(ot_taskid taskid, struct iovec *iovec) {
for (task = tasklist; task; task = task->next)
if (task->taskid == taskid) {
if( iovec ) {
fprintf(stderr, "mutex_workqueue_pushchunked pushing on taskid %lu\n", taskid);
if (!iovec_append(&task->iovec_entries, &task->iovec, iovec) )
return -1;
if (iovec_append(&task->iovec_entries, &task->iovec, iovec) )
task->tasktype = TASK_DONE_PARTIAL;
} else {
fprintf(stderr, "mutex_workqueue_pushchunked finished taskid %lu\n", taskid);
else
task = NULL;
} else
task->tasktype = TASK_DONE;
}
break;
}
@ -220,8 +218,6 @@ fprintf(stderr, "mutex_workqueue_pushchunked finished taskid %lu\n", taskid); @@ -220,8 +218,6 @@ fprintf(stderr, "mutex_workqueue_pushchunked finished taskid %lu\n", taskid);
pthread_mutex_unlock( &tasklist_mutex );
io_trywrite( g_self_pipe[1], &byte, 1 );
if(!task)
fprintf(stderr, "mutex_workqueue_pushchunked taskid %lu not found\n", taskid);
/* Indicate whether the worker has to throw away results */
return task ? 0 : -1;
@ -240,7 +236,6 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec, int @@ -240,7 +236,6 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec, int
for (task = &tasklist; *task; task = &((*task)->next))
if (((*task)->tasktype & TASK_CLASS_MASK ) == TASK_DONE) {
struct ot_task *ptask = *task;
fprintf(stderr, "Got task %lu type %d with %d entries\n", (*task)->taskid, (*task)->tasktype, ptask->iovec_entries);
*iovec_entries = ptask->iovec_entries;
*iovec = ptask->iovec;
sock = ptask->sock;

Loading…
Cancel
Save