Skip to content

Replacing network ConnectionEvent bitfield with enum.#1358

Merged
dnoe merged 4 commits intoenvoyproxy:masterfrom
alyssawilk:connection-event
Aug 1, 2017
Merged

Replacing network ConnectionEvent bitfield with enum.#1358
dnoe merged 4 commits intoenvoyproxy:masterfrom
alyssawilk:connection-event

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk commented Jul 31, 2017

Fixes #912

Copy link
Copy Markdown
Contributor

@dnoe dnoe left a comment

Choose a reason for hiding this comment

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

Lots of lines but little change. Two quick questions.

virtual void closeSocket(ConnectionEvent close_type);
void doConnect();
void raiseEvents(uint32_t events);
void raiseEvents(ConnectionEvent event);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could be renamed raiseEvent to match onEvent (which happened to be wrong before and is correct now :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call! too bad your reward is another 100 lines of string replaces...
Mostly test code though :-)

void onEvent(Network::ConnectionEvent event) override {
closed_ |= (event == Network::ConnectionEvent::RemoteClose ||
event == Network::ConnectionEvent::LocalClose);
connected_ |= (event == Network::ConnectionEvent::Connected);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, isn't |= a bitwise operator? This doesn't look right to me. I'm not sure it was right before, either?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine if you're using the least significant bit as the boolean value (and are happy with some implicit boolean/integer casting going on under the hood).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like the standard concretely guarantees that false is 0 and true is 1, so I think it's safe from UB. I think ye olde time C (before C99) only guaranteed that true expressions were non-zero. I guess it still works in that case but looks odd.

I'm OK with leaving it as is.

static const uint32_t RemoteClose = 0x1;
static const uint32_t LocalClose = 0x2;
static const uint32_t Connected = 0x4;
enum ConnectionEvent {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Prefer enum class, more type safe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ooh, good call. Updated this, and a bunch of tests that subsequently failed to compile.

void onEvent(Network::ConnectionEvent event) override {
closed_ |= (event == Network::ConnectionEvent::RemoteClose ||
event == Network::ConnectionEvent::LocalClose);
connected_ |= (event == Network::ConnectionEvent::Connected);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine if you're using the least significant bit as the boolean value (and are happy with some implicit boolean/integer casting going on under the hood).

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! LGTM beyond other comments.

@mattklein123
Copy link
Copy Markdown
Member

@alyssawilk random GH tip: If you put "Fixes #912" in the description, that PR will be auto closed when this merges.

Anyway, this LGTM other than the enum class comment.

}

ENVOY_CONN_LOG(debug, "closing socket: {}", *this, close_type);
ENVOY_CONN_LOG(debug, "closing socket: {}", *this, static_cast<uint32_t>(close_type));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be worth a << override, up to you. I wish C++ had a better stringification for eum class by default.

@dnoe dnoe merged commit bc2ca38 into envoyproxy:master Aug 1, 2017
@alyssawilk alyssawilk deleted the connection-event branch August 7, 2017 17:51
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

Add the support of forward_payload_header to jwt_auth

**What this PR does / why we need it**: Add the support of forward_payload_header to jwt_auth, which specifies the output header of the JWT payload.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes envoyproxy#1213 

**Special notes for your reviewer**:

**Release note**:

```release-note
```
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request May 4, 2024
It is required for LTO builds, specifically it fixes
stacktrace_unittest. This is because API of stacktrace capturing
functions implicitly assumes that those are not inlined.

Refers to github issue envoyproxy#1358.
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request May 4, 2024
Many our unit tests require specific stack traces or that
allocation/deallocation is not elimininated. As compilation gets more
aggressive (such as when cross-object optimization is enabled during
LTO), we break more of those cases.

This commit extends noopt usage that disables inlining optimization in
specific cases. This fixes github issue envoyproxy#1358.
mathetake pushed a commit that referenced this pull request Mar 3, 2026
…nthropic and VertexAI (#1358)

**Description**
Ensure the model name from response body is passed on to openAI response
body

---------

Signed-off-by: Sukumar Gaonkar <[email protected]>
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.

4 participants