Bug 855906 - Convert nsIWebsocketChannel pingInterval to seconds r=mcmanus

This commit is contained in:
Jason Duell
2013-04-05 13:52:12 -07:00
parent fdf45ca19e
commit d2a57b16b3
4 changed files with 27 additions and 17 deletions

View File

@@ -121,40 +121,46 @@ BaseWebSocketChannel::SetProtocol(const nsACString &aProtocol)
}
NS_IMETHODIMP
BaseWebSocketChannel::GetPingInterval(uint32_t *aMilliSeconds)
BaseWebSocketChannel::GetPingInterval(uint32_t *aSeconds)
{
*aMilliSeconds = mPingInterval;
// stored in ms but should only have second resolution
MOZ_ASSERT(!(mPingInterval % 1000));
*aSeconds = mPingInterval / 1000;
return NS_OK;
}
NS_IMETHODIMP
BaseWebSocketChannel::SetPingInterval(uint32_t aMilliSeconds)
BaseWebSocketChannel::SetPingInterval(uint32_t aSeconds)
{
if (mWasOpened) {
return NS_ERROR_IN_PROGRESS;
}
mPingInterval = aMilliSeconds;
mPingInterval = aSeconds * 1000;
mClientSetPingInterval = 1;
return NS_OK;
}
NS_IMETHODIMP
BaseWebSocketChannel::GetPingTimeout(uint32_t *aMilliSeconds)
BaseWebSocketChannel::GetPingTimeout(uint32_t *aSeconds)
{
*aMilliSeconds = mPingResponseTimeout;
// stored in ms but should only have second resolution
MOZ_ASSERT(!(mPingResponseTimeout % 1000));
*aSeconds = mPingResponseTimeout / 1000;
return NS_OK;
}
NS_IMETHODIMP
BaseWebSocketChannel::SetPingTimeout(uint32_t aMilliSeconds)
BaseWebSocketChannel::SetPingTimeout(uint32_t aSeconds)
{
if (mWasOpened) {
return NS_ERROR_IN_PROGRESS;
}
mPingResponseTimeout = aMilliSeconds;
mPingResponseTimeout = aSeconds * 1000;
mClientSetPingTimeout = 1;
return NS_OK;