Skip to content

Conversation

@zobo
Copy link
Contributor

@zobo zobo commented Nov 25, 2025

No description provided.

zobo added 3 commits November 25, 2025 03:28
…en switching between PIPE_WAIT and PIPE_NO_WAIT. Indicate logged values are hex not decimal.
…c prefix, but do report the full path to logs.
SetNamedPipeHandleState(XG_BASE(control_socket_h), &lpMode, NULL, NULL);
lpMode = PIPE_TYPE_BYTE | PIPE_WAIT;
if (!SetNamedPipeHandleState(XG_BASE(control_socket_h), &lpMode, NULL, NULL)) {
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_WARN, "CTRL-RECV", "Can't set NP handle state to 0x%x: 0x%x", lpMode, GetLastError());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a warning, and not an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below. Changed.

SetNamedPipeHandleState(XG_BASE(control_socket_h), &lpMode, NULL, NULL);
lpMode = PIPE_TYPE_BYTE | PIPE_NOWAIT;
if (!SetNamedPipeHandleState(XG_BASE(control_socket_h), &lpMode, NULL, NULL)) {
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_WARN, "CTRL-RECV", "Can't (post)set NP handle state to 0x%x: 0x%x", lpMode, GetLastError());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto: Why is this a warning, and not an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should never happen, and if it does, things might still work. But I changed to XLOG_ERR.

}

xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_INFO, "CTRL-OK", "Control socket set up successfully: '%s'", XG_BASE(control_socket_path));
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_INFO, "CTRL-OK", "Control socket set up successfully: '\\\\.\\pipe\\%s'", XG_BASE(control_socket_path));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you xdfree(name) after this, you don't have to re-introduce the \\\\.\\pipe\\ part, and you can just use name instead. But you also will have to free it before the return; in line 495/504.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code, your preferences. Changed.

derickr added a commit that referenced this pull request Dec 1, 2025
* pr/1049:
  Reorder xdfree(name) and removing trailing whitespace
  Tweak comments to use /* .. */ style
  Reuse created \\.\pipe name
  Change log level for failing SetNamedPipeHandleState
  Store the control_socket_path internally without the platform specific prefix, but do report the full path to logs.
  Fix wrong usage of SetNamedPipeHandleState and log possible errors when switching between PIPE_WAIT and PIPE_NO_WAIT. Indicate logged values are hex not decimal.
  Fix wrong file handler for response write
@derickr
Copy link
Contributor

derickr commented Dec 1, 2025

I've merged this after a rebase and a few tweaks (I prefer use the /* ... */ style of comments, for example).

Thanks!

@derickr derickr closed this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants