Changeset 9488f4575dc24414b3ed1696be5eea1db918f928
- Timestamp:
- 05/20/09 14:16:23
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1242828983 +0000
- git-parent:
[9332cdae593119fe293288b4be9f00c7ad864e5f]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1242828983 +0000
- Message:
better debugging, refs #42
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r88a7178 |
r9488f45 |
|
| 344 | 344 | eventer_ssl_ctx_t *ctx = e->opset_ctx; |
|---|
| 345 | 345 | int (*sslop)(SSL *) = NULL; |
|---|
| | 346 | const char *opstr = "none"; |
|---|
| 346 | 347 | |
|---|
| 347 | 348 | switch(op) { |
|---|
| 348 | 349 | case SSL_OP_READ: |
|---|
| | 350 | opstr = "read"; |
|---|
| 349 | 351 | if((rv = SSL_read(ctx->ssl, buffer, len)) > 0) return rv; |
|---|
| 350 | 352 | break; |
|---|
| 351 | 353 | case SSL_OP_WRITE: |
|---|
| | 354 | opstr = "write"; |
|---|
| 352 | 355 | if((rv = SSL_write(ctx->ssl, buffer, len)) > 0) return rv; |
|---|
| 353 | 356 | break; |
|---|
| 354 | 357 | |
|---|
| 355 | 358 | case SSL_OP_CONNECT: |
|---|
| | 359 | opstr = "connect"; |
|---|
| 356 | 360 | if(!sslop) sslop = SSL_connect; |
|---|
| 357 | 361 | /* fall through */ |
|---|
| 358 | 362 | case SSL_OP_ACCEPT: |
|---|
| | 363 | opstr = "accept"; |
|---|
| 359 | 364 | /* only set if we didn't fall through */ |
|---|
| 360 | 365 | if(!sslop) sslop = SSL_accept; |
|---|
| … | … | |
| 383 | 388 | break; |
|---|
| 384 | 389 | default: |
|---|
| 385 | | noitL(eventer_err, "SSL rw error: %d\n", sslerror); |
|---|
| | 390 | noitL(eventer_err, "SSL[%s of %d] rw error: %d\n", opstr, |
|---|
| | 391 | (int)len, sslerror); |
|---|
| 386 | 392 | eventer_ssl_error(); |
|---|
| 387 | 393 | errno = EIO; |
|---|
| rd346b50 |
r9488f45 |
|
| 129 | 129 | noit_connection_ctx_free(noit_connection_ctx_t *ctx) { |
|---|
| 130 | 130 | if(ctx->remote_cn) free(ctx->remote_cn); |
|---|
| | 131 | if(ctx->remote_str) free(ctx->remote_str); |
|---|
| 131 | 132 | if(ctx->timeout_event) { |
|---|
| 132 | 133 | eventer_remove(ctx->timeout_event); |
|---|
| … | … | |
| 178 | 179 | if(len < 0) { \ |
|---|
| 179 | 180 | if(errno == EAGAIN) return mask | EVENTER_EXCEPTION; \ |
|---|
| 180 | | noitL(noit_error, "SSL read error: %s\n", strerror(errno)); \ |
|---|
| | 181 | noitL(noit_error, "[%s] SSL read error: %s\n", nctx->remote_str, strerror(errno)); \ |
|---|
| 181 | 182 | goto socket_error; \ |
|---|
| 182 | 183 | } \ |
|---|
| … | … | |
| 184 | 185 | ctx->bytes_expected = 0; \ |
|---|
| 185 | 186 | if(len != size) { \ |
|---|
| 186 | | noitL(noit_error, "SSL short read [%d] (%d/%lu). Reseting connection.\n", \ |
|---|
| 187 | | ctx->state, len, (long unsigned int)size); \ |
|---|
| | 187 | noitL(noit_error, "[%s] SSL short read [%d] (%d/%lu). Reseting connection.\n", \ |
|---|
| | 188 | nctx->remote_str, ctx->state, len, (long unsigned int)size); \ |
|---|
| 188 | 189 | goto socket_error; \ |
|---|
| 189 | 190 | } \ |
|---|
| … | … | |
| 258 | 259 | case JLOG_STREAMER_WANT_BODY: |
|---|
| 259 | 260 | FULLREAD(e, ctx, (unsigned long)ctx->header.message_len); |
|---|
| 260 | | ctx->push(DS_OP_INSERT, &nctx->r.remote, ctx->buffer); |
|---|
| | 261 | if(ctx->header.message_len > 0) |
|---|
| | 262 | ctx->push(DS_OP_INSERT, &nctx->r.remote, ctx->buffer); |
|---|
| 261 | 263 | /* Don't free the buffer, it's used by the datastore process. */ |
|---|
| 262 | 264 | ctx->buffer = NULL; |
|---|
| … | … | |
| 434 | 436 | |
|---|
| 435 | 437 | ctx = noit_connection_ctx_alloc(); |
|---|
| | 438 | ctx->remote_str = calloc(1, strlen(host) + 7); |
|---|
| | 439 | snprintf(ctx->remote_str, strlen(host) + 7, |
|---|
| | 440 | "%s:%d", host, port); |
|---|
| 436 | 441 | |
|---|
| 437 | 442 | memset(&ctx->r, 0, sizeof(ctx->r)); |
|---|
| … | … | |
| 515 | 520 | config = noit_conf_get_hash(noit_configs[i], "config"); |
|---|
| 516 | 521 | |
|---|
| | 522 | noitL(noit_error, "initiating to %s\n", address); |
|---|
| 517 | 523 | initiate_noit_connection(address, port, sslconfig, config, |
|---|
| 518 | 524 | handler, |
|---|
| r88a7178 |
r9488f45 |
|
| 49 | 49 | } r; |
|---|
| 50 | 50 | socklen_t remote_len; |
|---|
| | 51 | char *remote_str; |
|---|
| 51 | 52 | char *remote_cn; |
|---|
| 52 | 53 | u_int32_t current_backoff; |
|---|