Skip to content

Commit

Permalink
Bug 1336855 - Use ScopedPRFileDesc for ssl_fd, r=franziskus
Browse files Browse the repository at this point in the history
--HG--
extra : histedit_source : c35a9233819f0b362a118a4f21a9d23a16c975c5
  • Loading branch information
martinthomson committed Feb 6, 2017
1 parent 461a681 commit 602249e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 72 deletions.
4 changes: 2 additions & 2 deletions gtests/ssl_gtest/test_io.cc
Expand Up @@ -291,12 +291,12 @@ static const struct PRIOMethods DummyMethods = {
DummyReserved, DummyReserved,
DummyReserved, DummyReserved};

PRFileDesc *DummyPrSocket::CreateFD() {
ScopedPRFileDesc DummyPrSocket::CreateFD() {
if (test_fd_identity == PR_INVALID_IO_LAYER) {
test_fd_identity = PR_GetUniqueIdentity("testtransportadapter");
}

PRFileDesc *fd = PR_CreateIOLayerStub(test_fd_identity, &DummyMethods);
ScopedPRFileDesc fd(PR_CreateIOLayerStub(test_fd_identity, &DummyMethods));
fd->secret = reinterpret_cast<PRFilePrivate *>(this);
return fd;
}
Expand Down
5 changes: 4 additions & 1 deletion gtests/ssl_gtest/test_io.h
Expand Up @@ -15,6 +15,7 @@
#include <string>

#include "prio.h"
#include "scoped_ptrs.h"

namespace nss_test {

Expand Down Expand Up @@ -59,7 +60,9 @@ class DummyPrSocket {
writeable_(true) {}
~DummyPrSocket();

PRFileDesc* CreateFD();
// Create a file descriptor that will reference this object. The fd must not
// live longer than this adapter; call PR_Close() before.
ScopedPRFileDesc CreateFD();

std::weak_ptr<DummyPrSocket>& peer() { return peer_; }
void SetPeer(const std::shared_ptr<DummyPrSocket>& peer) { peer_ = peer; }
Expand Down

0 comments on commit 602249e

Please sign in to comment.