(urgent - live game) Operation failed: OperationResponse 252: ReturnCode: -2

Options
jCan
jCan ✭✭
Where can I find information on this error? I have been looking for the codes but not much luck.

Operation failed: OperationResponse 252: ReturnCode: -2 (CAS update failed: property='248' has value='4'). Parameters: {} Server: GameServer
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1571)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)


I can't directly see what I am doing to trigger it nor do I know how to track down the root cause. I suspected it was this last bit of code I added, am I overlooking something?

I must admit I am not the most well versed with custom types so I probably made a mistake.

PhotonPeer.RegisterType (typeof(ObscuredInt), (byte)'I', SerializeObscuredInt, DeserializeObscuredInt);
PhotonPeer.RegisterType (typeof(ObscuredFloat), (byte)'F', SerializeObscuredFloat, DeserializeObscuredFloat);

	public static readonly byte[] memInt = new byte[4];

	private static short SerializeObscuredInt (StreamBuffer outStream, object customobject)
	{
		// get value from our custom object
		int integer = (ObscuredInt)customobject;
		lock (memInt) {
			byte[] bytes = memInt;
			int tOff = 0;
			Protocol.Serialize (integer, bytes, ref tOff);
			outStream.Write (bytes, 0, 4);
			return 4;
		}
	}

	private static object DeserializeObscuredInt (StreamBuffer inStream, short length)
	{
		int integer;
		lock (memInt) {
			inStream.Read (memInt, 0, 4);
			int tOff = 0;
			Protocol.Deserialize (out integer, memInt, ref tOff);
		}
		return (ObscuredInt)integer;
	}



	public static readonly byte[] memFloat = new byte[4];

	private static short SerializeObscuredFloat (StreamBuffer outStream, object customobject)
	{
		float flt = (ObscuredFloat)customobject;
		lock (memInt) {
			byte[] bytes = memInt;
			int tOff = 0;
			Protocol.Serialize (flt, bytes, ref tOff);
			outStream.Write (bytes, 0, 4);
			return 4;
		}
	}

	private static object DeserializeObscuredFloat (StreamBuffer inStream, short length)
	{
		float flt = 0;
		lock (memFloat) {
			inStream.Read (memFloat, 0, 4);
			int tOff = 0;
			Protocol.Deserialize (out flt, memFloat, ref tOff);
		}
		return (Ob</div>scuredFloat)flt;
	}

Comments

  • jCan
    jCan ✭✭
    Options
    Alright, so I just noticed this:
    (-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.


    But what does it mean exactly? It seems to imply I'm accessing something not registered.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @jCan,

    Thank you for choosing Photon!

    The error you reported means the following:

    You tried to switch the Master Client but it failed.
    Details:

    Switching Master Client is done using a SetProperties operation.
    Master Client is a well-known room property with byte key 248.
    SetProperties operation code is 252.
    Switch Master Client makes use of CAS ("Check-And-Set" or "Compare-And-Swap" using Expected Properties) to avoid concurrency issues, so a client that wants to switch the Master Client needs to provide current correct Master Client.
    In the case you reported, current Master Client is actor number 4 and when you wanted to switch the Master Client you provided an outdated/old incorrect value.