Exemple #1
0
 /// <summary>
 /// Callback for established outbound connections.
 /// </summary>
 /// <param name="photonPeer">The photon peer.</param>
 /// <param name="data">Contains the response headers from the handshake negotiation for outbound websocket connections; empty for all other connection types.</param>
 /// <param name="userData">The user data.</param>
 void IPhotonApplication.OnOutboundConnectionEstablished(IPhotonPeer photonPeer, byte[] data, object userData)
 {
     try
     {
         TemporaryServerPeer peer = userData as TemporaryServerPeer;
         if (peer != null)
         {
             peer.Application_OnOutboundConnectionEstablished(photonPeer);
         }
         else
         {
             log.ErrorFormat("Outbound connection established for peer {0} but user data contained unexpected data: {1}; aborting connection.", new object[] { photonPeer.GetConnectionID(), userData });
             photonPeer.DisconnectClient();
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
         throw;
     }
 }
Exemple #2
0
 /// <summary>
 /// Callback for failed outbound connections.
 /// </summary>
 /// <param name="photonPeer"> The photon peer.</param>
 /// <param name="userData">The user data.</param>
 /// <param name="errorCode">The error Code.</param>
 /// <param name="errorMessage">The error message</param>
 void IPhotonApplication.OnOutboundConnectionFailed(IPhotonPeer photonPeer, object userData, int errorCode, string errorMessage)
 {
     try
     {
         TemporaryServerPeer peer = userData as TemporaryServerPeer;
         if (peer != null)
         {
             this.OnServerConnectionFailed(errorCode, errorMessage, peer.State);
         }
         else
         {
             log.ErrorFormat("Outbound connection failed for peer {0}: {1} - {2}; user data contained unexpected data: {3}", new object[] { photonPeer.GetConnectionID(), errorCode, errorMessage, userData });
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
         throw;
     }
     finally
     {
         photonPeer.SetUserData(null);
     }
 }