Exemplo n.º 1
0
        private void OnP2PSessionConnectFail(P2PSessionConnectFail_t callback)
        {
            Identity ident = (SteamIdentity)callback.m_steamIDRemote;

            LogUtils.LogError("P2P connection failed for: " + callback.m_steamIDRemote + ", error: " + callback.m_eP2PSessionError);
            ((ServerConnection)Connection).DisconnectClient(ident);
        }
Exemplo n.º 2
0
 private static void P2PSessionConnectFail(P2PSessionConnectFail_t param)
 {
     Debug.LogError(string.Concat(new object[]
     {
         "P2PSessionConnectFail: error=",
         param.m_eP2PSessionError,
         ", remoteId=",
         param.m_steamIDRemote
     }));
     if (CoopLobby.Instance != null && CoopLobby.Instance.Info != null)
     {
         Debug.LogError("P2PSessionConnectFail: ServerId=" + CoopLobby.Instance.Info.ServerId);
         P2PSessionState_t s;
         if (SteamNetworking.GetP2PSessionState(CoopLobby.Instance.Info.ServerId, out s))
         {
             CoopSteamManager.Dump("Server", s);
         }
         Debug.LogError("P2PSessionConnectFail: OwnerSteamId=" + CoopLobby.Instance.Info.OwnerSteamId);
         if (SteamNetworking.GetP2PSessionState(CoopLobby.Instance.Info.OwnerSteamId, out s))
         {
             CoopSteamManager.Dump("Lobby Owner", s);
         }
     }
     else
     {
         Debug.LogError("P2PSessionConnectFail dump error: " + ((CoopLobby.Instance != null) ? "'CoopLobby.Instance.Info' is null" : "'CoopLobby.Instance' is null"));
     }
 }
        public override bool StartClient()
        {
            serverUser = new User(new CSteamID(ConnectToSteamID));

#if UNITY_SERVER
            if (SteamGameServerNetworking.SendP2PPacket(serverUser.SteamId, new byte[] { 0 }, 1, EP2PSend.k_EP2PSendReliable, (int)InternalChannelType.Connect))
#else
            if (SteamNetworking.SendP2PPacket(serverUser.SteamId, new byte[] { 0 }, 1, EP2PSend.k_EP2PSendReliable, (int)InternalChannelType.Connect))
#endif
            {
                _p2PSessionConnectFailCallback = Callback <P2PSessionConnectFail_t> .Create((sessionConnectFailInfo) =>
                {
                    OnP2PSessionConnectFail(sessionConnectFailInfo);
                });
            }
            else
            {
                P2PSessionConnectFail_t sessionConnectFailInfo = new P2PSessionConnectFail_t()
                {
                    m_eP2PSessionError = (byte)EP2PSessionError.k_EP2PSessionErrorMax,
                    m_steamIDRemote    = serverUser.SteamId
                };

                OnP2PSessionConnectFail(sessionConnectFailInfo);

                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        private void OnConnectFail(P2PSessionConnectFail_t result)
        {
            OnConnectionFailed(result.m_steamIDRemote);
            CloseP2PSessionWithUser(result.m_steamIDRemote);

            switch (result.m_eP2PSessionError)
            {
            case 1:
                Debug.LogError("Connection failed: The target user is not running the same game.");
                break;

            case 2:
                Debug.LogError("Connection failed: The local user doesn't own the app that is running.");
                break;

            case 3:
                Debug.LogError("Connection failed: Target user isn't connected to Steam.");
                break;

            case 4:
                Debug.LogError("Connection failed: The connection timed out because the target user didn't respond.");
                break;

            default:
                Debug.LogError("Connection failed: Unknown error.");
                break;
            }
        }
Exemplo n.º 5
0
        //-----------------------------------------------------------------------------
        // Purpose: Handle clients disconnecting
        //-----------------------------------------------------------------------------
        void OnP2PSessionConnectFail(P2PSessionConnectFail_t data)
        {
            if (data.m_eP2PSessionError > 0)
            {
                string e = string.Empty;

                Logging.BMSLog.Log("OnP2PSessionConnectFail Called steamIDRemote: " + data.m_steamIDRemote);
                Logging.BMSLog.Log("OnP2PSessionConnectFail error: [" + data.m_eP2PSessionError + "]"); // Riley
                Disconnect(steamPlayers[data.m_steamIDRemote], true);
                switch (data.m_eP2PSessionError)
                {
                case 1:
                    e = "The target user is not running the same game."; break;

                case 2:
                    e = "The local user doesn't own the app that is running."; break;

                case 3:
                    e = "Target user isn't connected to Steam."; break;

                case 4:
                    e = "The connection timed out because the target user didn't respond, perhaps they aren't calling AcceptP2PSessionWithUser"; break;
                }

                if (e != null)
                {
                    Logging.BMSLog.Log("<color=yellow>" + e + "</color>");
                }
            }
        }
        public override SocketTasks StartClient()
        {
            serverUser = new User(new CSteamID(ConnectToSteamID));

            SocketTask task = SocketTask.Working;

            if (SteamNetworking.SendP2PPacket(serverUser.SteamId, new byte[] { 0 }, 1, EP2PSend.k_EP2PSendReliable, (int)InternalChannelType.Connect))
            {
                _p2PSessionConnectFailCallback = Callback <P2PSessionConnectFail_t> .Create((sessionConnectFailInfo) =>
                {
                    OnP2PSessionConnectFail(sessionConnectFailInfo);
                    task.IsDone        = true;
                    task.Success       = false;
                    task.TransportCode = sessionConnectFailInfo.m_eP2PSessionError;
                });
            }
            else
            {
                P2PSessionConnectFail_t sessionConnectFailInfo = new P2PSessionConnectFail_t()
                {
                    m_eP2PSessionError = (byte)EP2PSessionError.k_EP2PSessionErrorMax,
                    m_steamIDRemote    = serverUser.SteamId
                };


                task.IsDone        = true;
                task.Success       = false;
                task.TransportCode = sessionConnectFailInfo.m_eP2PSessionError;

                OnP2PSessionConnectFail(sessionConnectFailInfo);
            }

            return(task.AsTasks());
        }
        private void OnConnectFail(P2PSessionConnectFail_t result)
        {
            if (LogFilter.Debug)
            {
                Debug.LogWarning("Connection failed or closed Steam ID " + result.m_steamIDRemote);
            }

            if (mode == Mode.CLIENT)
            {
                ClientDisconnect();
            }
            else if (mode == Mode.SERVER)
            {
                //one of the clients has disconnected
                SteamClient steamClient;
                try
                {
                    steamClient = steamConnectionMap.fromSteamID[result.m_steamIDRemote];
                    closeSteamConnection(steamClient);
                }
                catch (KeyNotFoundException)
                {
                    steamClient = null;
                }
            }
        }
Exemplo n.º 8
0
 private void OnSessionConnectFail(P2PSessionConnectFail_t result)
 {
     //IL_0011: Unknown result type (might be due to invalid IL or missing references)
     //IL_0012: Unknown result type (might be due to invalid IL or missing references)
     WeGameHelper.WriteDebugString(" OnSessionConnectFail");
     Close(result.m_steamIDRemote);
 }
Exemplo n.º 9
0
 void OnConnectFailed(P2PSessionConnectFail_t ev)
 {
     if (ev.m_steamIDRemote == Remote)
     {
         Debug.Log($"Disconnected from {Remote}");
         Disconnected = true;
     }
 }
        void OnP2PSessionConnectFail(P2PSessionConnectFail_t evt)
        {
            // TODO(james7132): Implement Properly
            var id    = evt.m_steamIDRemote;
            var error = (EP2PSessionError)evt.m_eP2PSessionError;

            Debug.LogError($"[Steam] Failed to connect to remote user {id}: {error}");
        }
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t request)
 {
     if (NetworkManager.Singleton.LogLevel <= LogLevel.Developer)
     {
         NetworkLog.LogInfoServer(nameof(SteamNetworkingTransport) + " - OnP2PSessionConnectFail - m_steamIDRemote: " + request.m_eP2PSessionError.ToString() + " Error: " + request.m_eP2PSessionError.ToString());
     }
     connectionAttemptFailed         = true;
     connectionAttemptFailedClientId = request.m_steamIDRemote.m_SteamID;
 }
Exemplo n.º 12
0
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t request)
 {
     if (LogHelper.CurrentLogLevel <= LogLevel.Developer)
     {
         LogHelper.LogInfo("SteamP2PTransport - OnP2PSessionConnectFail - m_steamIDRemote: " + request.m_eP2PSessionError.ToString() + " Error: " + request.m_eP2PSessionError.ToString());
     }
     connectionAttemptFailed         = true;
     connectionAttemptFailedClientId = request.m_steamIDRemote.m_SteamID;
 }
Exemplo n.º 13
0
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t request)
 {
     if (NetworkingManager.Singleton.LogLevel <= LogLevel.Developer)
     {
         UnityEngine.Debug.Log("SteamP2PTransport - OnP2PSessionConnectFail - m_steamIDRemote: " + request.m_eP2PSessionError.ToString() + " Error: " + request.m_eP2PSessionError.ToString());
     }
     connectionAttemptFailed         = true;
     connectionAttemptFailedClientId = request.m_steamIDRemote.m_SteamID;
 }
        private static void OnSessionConnectFailReceived(P2PSessionConnectFail_t param)
        {
            var error = (EP2PSessionError)param.m_eP2PSessionError;

            Console.WriteLine($"OnSessionConnectFailReceived {param.m_steamIDRemote} {error}");

            /*if (PortBindings.TryRemove(param.m_steamIDRemote, out ServerRetranslator retranslator))
             * {
             *  retranslator.Dispose();
             * }*/
        }
Exemplo n.º 15
0
 private void OnSessionConnectFail(P2PSessionConnectFail_t fail)
 {
     if (NetworkServer.active)
     {
         HandleSteamServerDisconnect(fail.m_steamIDRemote, NetworkError.Timeout);
     }
     else
     {
         HandleSteamClientDisconnect(NetworkError.Timeout);
     }
 }
Exemplo n.º 16
0
 // Token: 0x060009A3 RID: 2467 RVA: 0x000466C0 File Offset: 0x000448C0
 private static void OnConnectionFailed(P2PSessionConnectFail_t data)
 {
     ZLog.Log("Got connection failed callback: " + data.m_steamIDRemote);
     foreach (ZSteamSocketOLD zsteamSocketOLD in ZSteamSocketOLD.m_sockets)
     {
         if (zsteamSocketOLD.IsPeer(data.m_steamIDRemote))
         {
             zsteamSocketOLD.Close();
         }
     }
 }
Exemplo n.º 17
0
        private static void onP2PConnectionFail(P2PSessionConnectFail_t req)
        {
            Log.info("P2P connection status for " + req.m_steamIDRemote.m_SteamID + ": " + req.m_eP2PSessionError);
            if (req.m_eP2PSessionError != 0 /*EP2PSessionError.k_EP2PSessionErrorNone*/)
            {
                Log.warn("Connection failed for some reason or another.");

                IConnection conn;
                if (conns.TryGetValue(req.m_steamIDRemote.m_SteamID, out conn))
                {
                    conn.disconnect();
                    conns.Remove(req.m_steamIDRemote.m_SteamID);
                }
            }
        }
Exemplo n.º 18
0
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t callback)
 {
     if (P2PLogFilter.logError)
     {
         Debug.LogError(string.Format("[TransportLayerSteam] Connection error: {0} with steam user {1}", (EP2PSessionError)callback.m_eP2PSessionError, callback.m_steamIDRemote));
     }
     if (callback.m_eP2PSessionError != 0)
     {
         SteamNetworking.CloseP2PSessionWithUser(callback.m_steamIDRemote);
         int item;
         if (this.m_Connections.TryGetValue(callback.m_steamIDRemote, out item))
         {
             this.m_ConnectionsBrokenInternal.Push(item);
         }
     }
 }
Exemplo n.º 19
0
 public override void StartClient()
 {
     serverUser = new User(new CSteamID(ConnectToSteamID));
     if (SteamNetworking.SendP2PPacket(serverUser.SteamId, new byte[] { 0 }, 1, EP2PSend.k_EP2PSendReliable, (int)InternalChannelType.Connect))
     {
         _p2PSessionConnectFailCallback = Callback <P2PSessionConnectFail_t> .Create(OnP2PSessionConnectFail);
     }
     else
     {
         P2PSessionConnectFail_t sessionConnectFailInfo = new P2PSessionConnectFail_t()
         {
             m_eP2PSessionError = (byte)EP2PSessionError.k_EP2PSessionErrorMax,
             m_steamIDRemote    = serverUser.SteamId
         };
         OnP2PSessionConnectFail(sessionConnectFailInfo);
     }
 }
Exemplo n.º 20
0
        //note: can be called on the server too probably on its first message to the client. In any case, just try to disconnect
        private void OnConnectFail(P2PSessionConnectFail_t result)
        {
            Debug.LogWarning("Connection failed or closed Steam ID: " + result.m_steamIDRemote + " / eP2PSessionError : " + result.m_eP2PSessionError);

            if (mode == Mode.CLIENT)
            {
                ClientDisconnect();
            }
            else if (mode == Mode.SERVER)
            {
                try
                {
                    ServerDisconnect(steamConnectionMap.fromSteamID[result.m_steamIDRemote].connectionID);
                }
                catch (KeyNotFoundException)
                {
                }
            }
        }
    //-----------------------------------------------------------------------------
    // Purpose: Handle clients disconnecting
    //-----------------------------------------------------------------------------
    void OnP2PSessionConnectFail(P2PSessionConnectFail_t pCallback)
    {
        Debug.Log("OnP2PSessionConnectFail Called steamIDRemote: " + pCallback.m_steamIDRemote);         // Riley

        // socket has closed, kick the user associated with it

        /* TODO Riley: Disabled
         * for (uint i = 0; i < MAX_PLAYERS_PER_SERVER; ++i) {
         *      // If there is no ship, skip
         *      if (!m_rgClientData[i].m_bActive)
         *              continue;
         *
         *      if (m_rgClientData[i].m_SteamIDUser == pCallback.m_steamIDRemote) {
         *              Debug.Log("Disconnected dropped user");
         *              RemovePlayerFromServer(i);
         *              break;
         *      }
         * }*/
    }
Exemplo n.º 22
0
        private void OnConnectFail(P2PSessionConnectFail_t result)
        {
            switch (result.m_eP2PSessionError)
            {
            case 1:
                throw new Exception("Connection failed: The target user is not running the same game.");

            case 2:
                throw new Exception("Connection failed: The local user doesn't own the app that is running.");

            case 3:
                throw new Exception("Connection failed: Target user isn't connected to Steam.");

            case 4:
                throw new Exception("Connection failed: The connection timed out because the target user didn't respond.");

            default:
                throw new Exception("Connection failed: Unknown error.");
            }
        }
Exemplo n.º 23
0
 private void OnSessionConnectFail(P2PSessionConnectFail_t result)
 {
     this.Close((CSteamID)result.m_steamIDRemote);
 }
Exemplo n.º 24
0
 protected virtual void OnConnectFail(P2PSessionConnectFail_t result)
 {
     Debug.Log("OnConnectFail " + result);
 }
Exemplo n.º 25
0
 public void OnP2PSessionFail(P2PSessionConnectFail_t pCallback)
 {
     Logger.Error($"[P2PSessionConnectFail] Could not send packet to {pCallback.m_steamIDRemote}: {pCallback}");
 }
Exemplo n.º 26
0
 protected virtual void OnConnectFail(P2PSessionConnectFail_t result) => throw new Exception("Connection failed.");
Exemplo n.º 27
0
 public void P2PConnectionFail(P2PSessionConnectFail_t failResult)
 {
     Debug.LogError("P2P Error:" + ((EP2PSessionError)failResult.m_eP2PSessionError));
 }
Exemplo n.º 28
0
 void OnP2PSessionConnectFail(P2PSessionConnectFail_t pCallback)
 {
     Debug.Log("[" + P2PSessionConnectFail_t.k_iCallback + " - P2PSessionConnectFail] - " + pCallback.m_steamIDRemote + " -- " + pCallback.m_eP2PSessionError);
 }
Exemplo n.º 29
0
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t callback)
 {
     LogUtils.LogError("P2P connection failed for: " + callback.m_steamIDRemote + ", error: " + callback.m_eP2PSessionError);
 }
Exemplo n.º 30
0
 private void OnP2PSessionConnectFail(P2PSessionConnectFail_t pCallback)
 {
     Debug.Log("OnP2PSessionConnectFail Called steamIDRemote: " + pCallback.m_steamIDRemote);
 }