Add cs_get_error - #194
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a mechanism to attach and retrieve detailed error information from COMSTACK instances (notably for SSL/TLS failures), and wires those details into higher-level logging paths to improve diagnostics across the toolkit.
Changes:
- Introduces
cs_get_error/cs_set_errorand stores per-connection error details inCOMSTACK. - Populates SSL/TLS-related error details in the TCP/IP COMSTACK implementation and emits details in URL/server/client logging.
- Adds documentation and a unit test covering the new error-details behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/yaz/comstack.h |
Adds error_details field to struct comstack and declares cs_get_error / cs_set_error. |
src/comstack.c |
Implements cs_get_error and cs_set_error. |
src/tcpip.c |
Allocates/frees error_details and sets detailed SSL/TLS failure messages via cs_set_error. |
src/unix.c |
Allocates/frees error_details for UNIX-domain COMSTACK instances (and accepted connections). |
src/url.c |
Appends COMSTACK error code/message/details into yaz_url error output on failures. |
src/statserv.c |
Centralizes COMSTACK-aware logging for listen/accept/bind failures. |
client/client.c |
Improves diagnostics by printing/logging COMSTACK error code/message/details for connection and I/O failures. |
test/test_comstack.c |
Adds a unit test validating details lifecycle for cs_get_error/cs_set_error. |
doc/book.xml |
Documents the new API and adds it to the COMSTACK synopsis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Provides error details for COMSTACK failures. This is, especially, useful for SSL failures.
adamdickmeiss
force-pushed
the
cs-get-error
branch
from
July 23, 2026 16:26
21107d2 to
b313b71
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
src/tcpip.c:1158
- On this failure path,
state->sessionhas already been created bygnutls_init, buttcpip_state_destroy(state)does not deinitialize the GnuTLS session. This leaks the session whengnutls_set_default_priorityfails.
tcpip_state_destroy(state);
xfree(cnew);
return 0;
src/tcpip.c:1167
- Same as above: if
gnutls_credentials_setfails,state->sessionis still live, buttcpip_state_destroy(state)doesn't callgnutls_deinit. Deinitialize the session before destroying the state to avoid leaking the TLS session object.
tcpip_state_destroy(state);
xfree(cnew);
return 0;
Instead consistently print to stdout for info messages and stderr for error messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Provides error details for COMSTACK failures. This is, especially, useful for SSL failures.