mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1184226 - Disabling write on shutdown, r=ekr
This commit is contained in:
parent
1433cdee9e
commit
2832da0934
@ -102,6 +102,11 @@ int32_t TransportLayerNSPRAdapter::Recv(void *buf, int32_t buflen) {
|
||||
}
|
||||
|
||||
int32_t TransportLayerNSPRAdapter::Write(const void *buf, int32_t length) {
|
||||
if (!enabled_) {
|
||||
MOZ_MTLOG(ML_WARNING, "Writing to disabled transport layer");
|
||||
return -1;
|
||||
}
|
||||
|
||||
TransportResult r = output_->SendPacket(
|
||||
static_cast<const unsigned char *>(buf), length);
|
||||
if (r >= 0) {
|
||||
@ -200,8 +205,12 @@ static PRStatus TransportLayerListen(PRFileDesc *f, int32_t depth) {
|
||||
}
|
||||
|
||||
static PRStatus TransportLayerShutdown(PRFileDesc *f, int32_t how) {
|
||||
UNIMPLEMENTED;
|
||||
return PR_FAILURE;
|
||||
// This is only called from NSS when we are the server and the client refuses
|
||||
// to provide a certificate. In this case, the handshake is destined for
|
||||
// failure, so we will just let this pass.
|
||||
TransportLayerNSPRAdapter *io = reinterpret_cast<TransportLayerNSPRAdapter *>(f->secret);
|
||||
io->SetEnabled(false);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
// This function does not support peek, or waiting until `to`
|
||||
|
@ -33,17 +33,20 @@ class TransportLayerNSPRAdapter {
|
||||
public:
|
||||
explicit TransportLayerNSPRAdapter(TransportLayer *output) :
|
||||
output_(output),
|
||||
input_() {}
|
||||
input_(),
|
||||
enabled_(true) {}
|
||||
|
||||
void PacketReceived(const void *data, int32_t len);
|
||||
int32_t Recv(void *buf, int32_t buflen);
|
||||
int32_t Write(const void *buf, int32_t length);
|
||||
void SetEnabled(bool enabled) { enabled_ = enabled; }
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_ASSIGN(TransportLayerNSPRAdapter);
|
||||
|
||||
TransportLayer *output_;
|
||||
std::queue<Packet *> input_;
|
||||
bool enabled_;
|
||||
};
|
||||
|
||||
class TransportLayerDtls final : public TransportLayer {
|
||||
|
Loading…
Reference in New Issue
Block a user