Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PCAP example to be async #1422

Merged
merged 5 commits into from
Jun 1, 2022

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jun 1, 2022

Motivation:

Our examples should at least attempt to be up-to-date. The PCAP example
currenly uses the NIO based API, we should switch it to the async API.

Modifications:

  • Update the PCAP example to use async/await
  • Rename main.swift to PacketCapture.swift
  • Ditch logging for print

Result:

PCAP example is async/await

Motivation:

Our examples should at least attempt to be up-to-date. The PCAP example
currenly uses the NIO based API, we should switch it to the async API.

Modifications:

- Update the PCAP example to use async/await
- Ditch logging for print

Result:

PCAP example is async/await
Copy link
Collaborator

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

LGTM! Just a small question


// Ensure that we close the file sink when we're done with it.
defer {
try? fileSink.syncClose()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we ? and ! in the above defer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No particular reason.

@glbrntt glbrntt merged commit d3f5f64 into grpc:1.7.1-async-await Jun 1, 2022
@glbrntt glbrntt deleted the gb-pcap-example branch June 1, 2022 14:58
@glbrntt glbrntt added the semver/none No version bump required. label Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants