started analysis of ping response and clean up more logger
This commit is contained in:
parent
da1e7cc211
commit
c0f02d774a
@ -483,14 +483,23 @@ function admin_page_hubloc_post(&$a){
|
|||||||
//perform ping
|
//perform ping
|
||||||
$m = zot_build_packet($a->get_channel(),'ping');
|
$m = zot_build_packet($a->get_channel(),'ping');
|
||||||
$r = zot_zot($hublocurl,$m);
|
$r = zot_zot($hublocurl,$m);
|
||||||
logger('ping answer: ' . print_r($r,true), LOGGER_DEBUG);
|
//handle results and set the hubloc flags in db to make results visible
|
||||||
|
$r2 = $r[body];
|
||||||
|
$r3 = $r2[success];
|
||||||
|
if ( $r3[success] == True ){
|
||||||
|
//set HUBLOC_OFFLINE to 0
|
||||||
|
logger(' success = true ',LOGGER_DEBUG);
|
||||||
|
} else {
|
||||||
|
//set HUBLOC_OFFLINE to 1
|
||||||
|
logger(' success = false ', LOGGER_DEBUG);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//unfotunatly zping wont work, I guess return format is not correct
|
//unfotunatly zping wont work, I guess return format is not correct
|
||||||
//require_once('mod/zping.php');
|
//require_once('mod/zping.php');
|
||||||
//$r = zping_content($hublocurl);
|
//$r = zping_content($hublocurl);
|
||||||
//logger('zping answer: ' . $r, LOGGER_DEBUG);
|
//logger('zping answer: ' . $r, LOGGER_DEBUG);
|
||||||
|
|
||||||
//handle results and set the hubloc flags in db to make results visible
|
|
||||||
|
|
||||||
//in case of repair store new pub key for tested hubloc (all channel with this hubloc) in db
|
//in case of repair store new pub key for tested hubloc (all channel with this hubloc) in db
|
||||||
//after repair set hubloc flags to 0
|
//after repair set hubloc flags to 0
|
||||||
|
10
mod/post.php
10
mod/post.php
@ -9,8 +9,6 @@ require_once('include/zot.php');
|
|||||||
|
|
||||||
|
|
||||||
function post_init(&$a) {
|
function post_init(&$a) {
|
||||||
logger('POST inside',LOGGER_DEBUG);
|
|
||||||
logger('POST given parameter: ' . print_r($_REQUEST,true), LOGGER_DEBUG);
|
|
||||||
|
|
||||||
// Most access to this endpoint is via the post method.
|
// Most access to this endpoint is via the post method.
|
||||||
// Here we will pick out the magic auth params which arrive
|
// Here we will pick out the magic auth params which arrive
|
||||||
@ -257,6 +255,11 @@ function post_init(&$a) {
|
|||||||
$a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
|
$a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
|
||||||
info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name']));
|
info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name']));
|
||||||
logger('mod_zot: auth success from ' . $x[0]['xchan_addr']);
|
logger('mod_zot: auth success from ' . $x[0]['xchan_addr']);
|
||||||
|
q("update hubloc set hubloc_status = (hubloc_status | %d ) where hubloc_id = %d ",
|
||||||
|
intval(HUBLOC_WORKS),
|
||||||
|
intval($x[0]['hubloc_id'])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($test) {
|
if($test) {
|
||||||
@ -447,14 +450,12 @@ function post_init(&$a) {
|
|||||||
|
|
||||||
function post_post(&$a) {
|
function post_post(&$a) {
|
||||||
|
|
||||||
logger('mod_zot: ' . print_r($_REQUEST,true), LOGGER_DEBUG);
|
|
||||||
|
|
||||||
$encrypted_packet = false;
|
$encrypted_packet = false;
|
||||||
$ret = array('success' => false);
|
$ret = array('success' => false);
|
||||||
|
|
||||||
$data = json_decode($_REQUEST['data'],true);
|
$data = json_decode($_REQUEST['data'],true);
|
||||||
|
|
||||||
logger('mod_zot: data: ' . print_r($data,true), LOGGER_DATA);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Many message packets will arrive encrypted. The existence of an 'iv' element
|
* Many message packets will arrive encrypted. The existence of an 'iv' element
|
||||||
@ -483,7 +484,6 @@ function post_post(&$a) {
|
|||||||
$data = array('type' => 'bogus');
|
$data = array('type' => 'bogus');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('mod_zot: decoded data: ' . print_r($data,true), LOGGER_DATA);
|
|
||||||
|
|
||||||
$msgtype = ((array_key_exists('type',$data)) ? $data['type'] : '');
|
$msgtype = ((array_key_exists('type',$data)) ? $data['type'] : '');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user