diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-08-12 09:40:09 +0100 |
---|---|---|
committer | Olivier Crête <olivier.crete@collabora.com> | 2014-08-21 14:33:11 -0400 |
commit | 61e1cfbe83e0c9076046ef196c5b7668567cdcb1 (patch) | |
tree | 325d75e18c11ea01bb0c9324cb5c96f531a0f006 /agent/pseudotcp.c | |
parent | 0cd0729d8c498c1e82e9834cbff00644bc4b7e9c (diff) | |
download | libnice-61e1cfbe83e0c9076046ef196c5b7668567cdcb1.tar.gz |
pseudotcp: Ensure shutdown member is not overwritten
Add a few safeguards to ensure that once priv->shutdown is set, it is
not overwritten with a different value.
Diffstat (limited to 'agent/pseudotcp.c')
-rw-r--r-- | agent/pseudotcp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/agent/pseudotcp.c b/agent/pseudotcp.c index 303adda..bc4dc5b 100644 --- a/agent/pseudotcp.c +++ b/agent/pseudotcp.c @@ -1253,7 +1253,8 @@ pseudo_tcp_socket_shutdown (PseudoTcpSocket *self, PseudoTcpShutdown how) /* FIN-ACK--only stuff below here. */ if (!priv->support_fin_ack) { - priv->shutdown = SD_GRACEFUL; + if (priv->shutdown == SD_NONE) + priv->shutdown = SD_GRACEFUL; return; } @@ -2144,14 +2145,18 @@ attempt_send(PseudoTcpSocket *self, SendFlags sflags) static void closedown (PseudoTcpSocket *self, guint32 err, ClosedownSource source) { - if (source == CLOSEDOWN_LOCAL && self->priv->support_fin_ack) { + PseudoTcpSocketPrivate *priv = self->priv; + + if (source == CLOSEDOWN_LOCAL && priv->support_fin_ack) { queue_rst_message (self); attempt_send (self, sfRst); + } else if (source == CLOSEDOWN_LOCAL) { + priv->shutdown = SD_FORCEFUL; } /* ‘Cute’ little navigation through the state machine to avoid breaking the * invariant that CLOSED can only be reached from TIME-WAIT or LAST-ACK. */ - switch (self->priv->state) { + switch (priv->state) { case TCP_LISTEN: case TCP_SYN_SENT: break; |