X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Flib%2FauthClient.php;h=735c8a1dcd3c372cb5471c7e2caf96fc692623a8;hp=c5ef6dd15eaba37eb583367e6558ccf72d4eff92;hb=590f7600a8319d4ae08c32a32e7713ea6f9e2edb;hpb=fbe9740a0e8f0ee450cf2657fca374799e715c7d diff --git a/authserver/lib/authClient.php b/authserver/lib/authClient.php index c5ef6dd..735c8a1 100644 --- a/authserver/lib/authClient.php +++ b/authserver/lib/authClient.php @@ -3,6 +3,32 @@ require_once("lib.php"); class GAAuthClient { + function syncUserToken($username, $tokenone, $tokentwo) { + global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; + + + if(!msg_queue_exists($MSG_QUEUE_KEY_ID_SERVER)) { + return false; + } + + if(!msg_queue_exists($MSG_QUEUE_KEY_ID_CLIENT)) { + return false; + } + // TODO we need to setup a client queue sem lock here + + $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT); + $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER); + + $message["username"] = $username; + $message["tokenone"] = $tokenone; + $message["tokentwo"] = $tokentwo; + + msg_send($sr_queue, MSG_SYNC_TOKEN, $message, true, true, $msg_err); + + msg_receive($cl_queue, 0, $msg_type, 16384, $msg); + return $msg; + + } function setUserToken($username, $token) { global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT;