Jump to content
  • 0

Cached Packets Working But With Error?


tk422

Question

Greetings, Again!

 

I've been working on a custom control panel and have many of the standard SQL based commands in, but today started working on sending CacheD packets for things like changing a character name.

 

In this example i change a character named "Bob" with a char_id of 2 to the name "Salsa".

The change DID happen. I logged in and saw the new name, the SQL updated. 

 

However, i'm getting this message in CacheD status log.

 

Is this normal? Any idea how i can fix this?

 

aec2758102.png

 

Thank you all once again for your help!

 

• Update 1 - It seems like there is only this issue while changing character name. I've implemented a few others packets which all work perfectly with no errors...

Edited by Universe
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hello,

 

Is ok. I get same from my panel. :)

 

Ahh, ok. Good to know! Many <3's to you!

 

I asked the AdvExt guys and they say that when using their control panel CacheD doesn't give this error.

 

I was sent their packet manipulation scripts as documentation and am using them verbatim. I don't know how their CP doesn't do this unless they aren't changing char name though a CacheD packet.

 

I think that if the packet im sending was "wrong" in some way CacheD would simply reject it.

Is this correct?

 

Could this be an issue with a the stored procedure: lin_GetUserDataByCharName?

Link to comment
Share on other sites

  • 0

Whats your code look like?

 

I'm actually using Node.JS and Javascript, not PHP. Working on a full REST API.

 

http://pastebin.com/i2ghYYi6

 

Like i said, the packets all WORK ok. Like they do what they're supposed to without issue. it's just CacheD giving this error with this one.

 

module.exports.configz is what's kicking everything off. (I'm calling this from another file)

It generates a packet with the supplied values and then calls the submitPacket function which actually does the submission to CacheD.

 

The other packets i've made work correctly and with no errors, it's just this one.

 

- Update: Found the issue (i think), Working on how to solve it.

I'm opening a socket to CacheD and leaving it open. It looks like whatever command i'm sending is getting sent multiple times where it should be sending once and then disconnecting. Working on a fix.

Edited by tk422
Link to comment
Share on other sites

  • 0

You don't seem to close any connections - most php implementations do this and if my brain remembers that is how it's designed for in cacheD.

 

 

NINJA:

argh didn't read proper you already saw that.

I'll test if i have time myself.

Edited by mcbigmac
Link to comment
Share on other sites

  • 0

You don't seem to close any connections - most php implementations do this and if my brain remembers that is how it's designed for in cacheD.

 

 

NINJA:

argh didn't read proper you already saw that.

I'll test if i have time myself.

 

Yah this is exactly what's happening. Ii'm now closing the socket and all is well.

 

My problem now is how to read the result of what CacheD sends back when the packet has been submitted.

 

This is the original function:

	function CacheDInteractive($buf) {
		$fp = fsockopen($this->cachedip, $this->cachedport , $errno, $errstr, 5);
		$rs = '';
		if (!$fp) return $this -> fsockerror;

		$packet = pack("s", (strlen($buf)+2)).$buf;
		fwrite($fp, $packet);
		$len = unpack("v", fread($fp, 2));
		$rid = unpack("c", fread($fp, 1));
		for ($i = 0; $i < (($len[1]-4) / 4); $i++) { 
			$read = unpack("i", fread($fp, 4));
			$rs .= $read[1];
		}
		fclose($fp);
		$result = $this -> socketerrors[$rs];
		
	return($result);
	}

These two calls:

$len = unpack("v", fread($fp, 2));

$rid = unpack("c", fread($fp, 1));

+ the foor loop are proving problematic.

 

These functions don't exist in JS, so i have to find another solution to do the conversion and then to get the error code.

 

I can read the data sent back from CacheD but each time i get BwA3AQAA which equals 7. Error code 7 is "Char is currently logged in". Somethings weird because this is not the case for the char im testing operations on. THough like i said im not doing the conversion.

Edited by tk422
Link to comment
Share on other sites

  • 0

http://phpjs.org/functions/fread/

 

google is your friend.

 

Haven't been updating this post. Should have been.. :P

 

I've figured out how to read the response ok. But now the issue is converting it into the friendly error code.

    cachedSocket.on('data', function(data) {
        if (data) {
            var response = toArrayBuffer(data);
            var len = response.slice(0,2);
            var rid = response.slice(0,1);
            var rs = '';
            for (var i = 0; i < ((len[1]-4) / 4); i++) {
                var read = response.slice(0,4);
                rs += read[1];
            }
            console.log(rs);
        }
    });

rs is undefined at the end of execution and i'm not sure why.

I'm getting to the point where i'll pay anyone who can solve this issue lol.

Edited by tk422
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...