internal override bool SendOutgoingCommands() { if (base.peerConnectionState == ConnectionStateValue.Disconnected) { return(false); } if (!base.PhotonSocket.Connected) { return(false); } base.timeInt = SupportClass.GetTickCount() - base.timeBase; base.timeLastSendOutgoing = base.timeInt; if (base.peerConnectionState == ConnectionStateValue.Connected && Math.Abs(SupportClass.GetTickCount() - this.lastPingResult) > base.timePingInterval) { this.SendPing(); } List <StreamBuffer> obj = this.outgoingStream; lock (obj) { for (int i = 0; i < this.outgoingStream.Count; i++) { StreamBuffer streamBuffer = this.outgoingStream[i]; this.SendData(streamBuffer.GetBuffer(), streamBuffer.IntLength); PeerBase.MessageBufferPoolPut(streamBuffer); } this.outgoingStream.Clear(); base.outgoingCommandsInStream = 0; } return(false); }
internal void SendPing() { int num = this.lastPingResult = SupportClass.GetTickCount(); if (!this.DoFraming) { SendOptions sendOptions = new SendOptions() { DeliveryMode = DeliveryMode.Reliable }; StreamBuffer streamBuffer = this.SerializeOperationToMessage(PhotonCodes.Ping, new Dictionary <byte, object> { { (byte)1, (object)num } }, EgMessageType.InternalOperationRequest, sendOptions.Encrypt); if (base.TrafficStatsEnabled) { base.TrafficStatsOutgoing.CountControlCommand(streamBuffer.IntLength); } this.SendData(streamBuffer.GetBuffer(), streamBuffer.IntLength); PeerBase.MessageBufferPoolPut(streamBuffer); } else { int num2 = 1; Protocol.Serialize(num, this.pingRequest, ref num2); if (base.TrafficStatsEnabled) { base.TrafficStatsOutgoing.CountControlCommand(this.pingRequest.Length); } this.SendData(this.pingRequest, this.pingRequest.Length); } }
public void FreePayload() { if (this.Payload != null) { PeerBase.MessageBufferPoolPut(this.Payload); } this.Payload = null; }