/ Check-in [d8568aac]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | server-edition
Files: files | file ages | folders
SHA3-256:d8568aacf083b63cdcf68d744ddb07a7615d14f169be6c632813a266a1e8a1cf
User & Date: dan 2017-06-20 19:20:07
Context
2017-06-28
20:12
Fix bugs in test program tserver.c. Leaf check-in: 093b9108 user: dan tags: server-edition
2017-06-27
20:23
Support clients within a single process only. check-in: dfa9a4d5 user: dan tags: server-process-edition
2017-06-20
19:20
Ensure that test tool "tserver" finalizes all statements before attempting to close a database handle. check-in: d8568aac user: dan tags: server-edition
2017-06-07
15:55
Add too/tserver.c - the implementation of a simple multi-threaded server designed for interactive testing of concurrency between connections used by different threads of the same process. check-in: 05b4fc43 user: dan tags: server-edition
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/tserver.c.

264
265
266
267
268
269
270

271
272
273
274
275
276
277
...
342
343
344
345
346
347
348




349
350
351
352
353
354
355
}

static void *handle_client(void *pArg){
  char zCmd[32*1024];             /* Read buffer */
  int nCmd = 0;                   /* Valid bytes in zCmd[] */
  int res;                        /* Result of read() call */
  int rc = SQLITE_OK;


  ClientCtx ctx;
  memset(&ctx, 0, sizeof(ClientCtx));

  ctx.fd = (int)(intptr_t)pArg;
  ctx.nRepeat = 1;
  rc = sqlite3_open(zDatabaseName, &ctx.db);
................................................................................
        }
      }
    }while( rc==SQLITE_OK && nConsume>0 );
  }

  fprintf(stdout, "Client %d disconnects\n", ctx.fd);
  close(ctx.fd);




  sqlite3_close(ctx.db);
  return 0;
} 

int main(int argc, char *argv[]) {
  sqlite3 *db;
  int sfd;







>







 







>
>
>
>







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
}

static void *handle_client(void *pArg){
  char zCmd[32*1024];             /* Read buffer */
  int nCmd = 0;                   /* Valid bytes in zCmd[] */
  int res;                        /* Result of read() call */
  int rc = SQLITE_OK;
  int j;

  ClientCtx ctx;
  memset(&ctx, 0, sizeof(ClientCtx));

  ctx.fd = (int)(intptr_t)pArg;
  ctx.nRepeat = 1;
  rc = sqlite3_open(zDatabaseName, &ctx.db);
................................................................................
        }
      }
    }while( rc==SQLITE_OK && nConsume>0 );
  }

  fprintf(stdout, "Client %d disconnects\n", ctx.fd);
  close(ctx.fd);
  for(j=0; j<ctx.nPrepare; j++){
    sqlite3_finalize(ctx.apPrepare[j]);
  }
  sqlite3_free(ctx.apPrepare);
  sqlite3_close(ctx.db);
  return 0;
} 

int main(int argc, char *argv[]) {
  sqlite3 *db;
  int sfd;