Skip to content

Commit

Permalink
StopTLS: add support for io_uring socket cert
Browse files Browse the repository at this point in the history
Summary: StopTLS: add support for io_uring socket cert

Reviewed By: robertroeser, mingtaoy

Differential Revision: D48442529

fbshipit-source-id: f73f13d26793704dd2815765fd7d311c7e4b8dff
  • Loading branch information
Dan Melnic authored and facebook-github-bot committed Aug 18, 2023
1 parent b8f65b1 commit 152fb9f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions folly/experimental/io/AsyncIoUringSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class IoUringBackend;

class AsyncIoUringSocket : public AsyncSocketTransport {
public:
using Cert = folly::AsyncTransportCertificate;
struct Options {
Options()
: allocateNoBufferPoolBuffer(defaultAllocateNoBufferPoolBuffer),
Expand Down Expand Up @@ -212,6 +213,26 @@ class AsyncIoUringSocket : public AsyncSocketTransport {
applicationProtocol_ = std::move(s);
}

const folly::AsyncTransportCertificate* getPeerCertificate() const override {
return peerCert_.get();
}

const folly::AsyncTransportCertificate* getSelfCertificate() const override {
return selfCert_.get();
}

void dropPeerCertificate() noexcept override { peerCert_.reset(); }

void dropSelfCertificate() noexcept override { selfCert_.reset(); }

void setPeerCertificate(const std::shared_ptr<const Cert>& peerCert) {
peerCert_ = peerCert;
}

void setSelfCertificate(const std::shared_ptr<const Cert>& selfCert) {
selfCert_ = selfCert;
}

void asyncDetachFd(AsyncDetachFdCallback* callback);
bool readSqeInFlight() const { return readSqe_->inFlight(); }
bool getTFOSucceded() const override;
Expand Down Expand Up @@ -470,6 +491,9 @@ class AsyncIoUringSocket : public AsyncSocketTransport {
std::string securityProtocol_;
std::string applicationProtocol_;

std::shared_ptr<const Cert> selfCert_;
std::shared_ptr<const Cert> peerCert_;

// shutdown:
int shutdownFlags_ = 0;

Expand Down

0 comments on commit 152fb9f

Please sign in to comment.