We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73674af commit 32b765eCopy full SHA for 32b765e
tcpmux.c
@@ -53,7 +53,23 @@ static struct tmux_stream *all_stream;
53
* @param stream A pointer to the `tmux_stream` structure to be added.
54
*/
55
void add_stream(struct tmux_stream *stream) {
56
+ // Validate input parameter
57
+ if (!stream) {
58
+ debug(LOG_ERR, "Cannot add NULL stream");
59
+ return;
60
+ }
61
+
62
+ // Check if stream already exists
63
+ struct tmux_stream *existing = NULL;
64
+ HASH_FIND_INT(all_stream, &stream->id, existing);
65
+ if (existing) {
66
+ debug(LOG_WARNING, "Stream %u already exists in hash table", stream->id);
67
68
69
70
+ // Add stream to hash table
71
HASH_ADD_INT(all_stream, id, stream);
72
+ debug(LOG_DEBUG, "Added stream %u to hash table", stream->id);
73
}
74
75
/**
0 commit comments