From e35b041f0e613627778c5d69ff2f7098d965c707 Mon Sep 17 00:00:00 2001 From: Aastha Mehta <aasthakm@mpi-sws.org> Date: Mon, 6 Jan 2020 12:48:10 +0000 Subject: [PATCH] formatting --- sme_extn/sme_helper.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/sme_extn/sme_helper.php b/sme_extn/sme_helper.php index 7a788dbe..45fd738e 100644 --- a/sme_extn/sme_helper.php +++ b/sme_extn/sme_helper.php @@ -480,7 +480,7 @@ function set_request_id($pubinput, $privinput) */ $cpu_load = 100; - if(isset($wgSMECPUUtilMarker) && $wgSMECPUUtilMarker ==1) { + if (isset($wgSMECPUUtilMarker) && $wgSMECPUUtilMarker == 1) { $filename = "/mnt/cpu_util/cpu_util.txt"; $handle = fopen($filename, "r"); $cpu_load = fread($handle, 4); @@ -506,7 +506,7 @@ function set_request_id($pubinput, $privinput) $cluster_name= $cpu_load . $pubinput[$i]; $pubinput[$i]= $cpu_load . $pubinput[$i]; - if(isset($wgSMEPrivBinning) && $wgSMEPrivBinning ==1) { + if (isset($wgSMEPrivBinning) && $wgSMEPrivBinning == 1) { $hash=md5($privinput[$i]); $file_size = filesize($wgFileCacheDirectory.'/'.substr($hash,0,1).'/'.substr($hash,0,2).'/'.urlencode($privinput[$i]).'.html.gz'); if (intval($file_size) <= 6000){ @@ -561,8 +561,7 @@ function create_tmp_profile_marker(&$buf, &$buf_len, $src_ip, $src_port, global $SME_KERNEL_ENFORCEMENT_TIMESTAMP; $SME_MARKER_TIMESTAMP = $SME_KERNEL_ENFORCEMENT_TIMESTAMP; - if ($SME_MARKER_TIMESTAMP == -1) - { + if ($SME_MARKER_TIMESTAMP == -1) { $SME_MARKER_TIMESTAMP = $SME_REQUEST_TIMESTAMP; } @@ -664,7 +663,7 @@ function create_tmp_profile_marker(&$buf, &$buf_len, $src_ip, $src_port, $dstr .= ", dst port: $dst_port"; $dstr .= ", num pub: $num_pub"; $dstr .= ", num priv: $num_priv"; - if($num_pub > 0){ + if ($num_pub > 0) { $pubhash1 = bin2hex($pubhash[0]); $dstr .= ", pub_hash1: $pubhash1"; } @@ -699,7 +698,7 @@ function appendProfileLog($action, $title) global $l_output; global $wgEnableSMELogging; - if( !isset($wgEnableSMELogging) || $wgEnableSMELogging != 1){ + if (!isset($wgEnableSMELogging) || $wgEnableSMELogging != 1) { return; } get_local_ip_port($server_ip, $server_port); @@ -736,7 +735,7 @@ function sendBackendProfileToBackendMysql($pbuf_BE_FE, $plen_BE_FE, $mysqli, file_put_contents("/local/sme/msg_sent_to_kernel.txt", "UDPSOCK RESULT: $restr", FILE_APPEND | LOCK_EX); } - if(!is_bool($result)){ + if (!is_bool($result)) { $result->close(); } } else { @@ -771,14 +770,14 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) get_local_ip_port($server_ip, $server_port); get_remote_ip_port($client_ip, $client_port); - if (isset($wgSMEStats) && $wgSMEStats){ + if (isset($wgSMEStats) && $wgSMEStats) { $time_start = microtime(true); } identify_backend_connection($local_backend_ip, $local_backend_port, $remote_backend_ip, $remote_backend_port); - if (isset($wgSMEStats) && $wgSMEStats){ + if (isset($wgSMEStats) && $wgSMEStats) { $time_end = microtime(true); $time = $time_end - $time_start; file_put_contents("/local/sme/stats_5_tuple.txt", @@ -829,9 +828,9 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) } // Send FE-BE profile marker to kernel - if (isset($wgSMEIOCTL) && $wgSMEIOCTL){ + if (isset($wgSMEIOCTL) && $wgSMEIOCTL) { $ret = dev_ioctl($SME_MARKER_SOCK_OR_CTL, 0, $pbuf_FE_BE, $plen_FE_BE); - }else{ + } else { $ret = socket_sendto($SME_MARKER_SOCK_OR_CTL, $pbuf_FE_BE, $plen_FE_BE, 0, $dummy_server_ip, $dummy_server_port); } @@ -845,10 +844,10 @@ function sendBackendProfileToKernel($pubhash, $privhash, $mysqli) echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { - if (isset($wgSMEIOCTL) && $wgSMEIOCTL){ + if (isset($wgSMEIOCTL) && $wgSMEIOCTL) { dev_close($SME_MARKER_SOCK_OR_CTL); #echo "Sent BE, closing ioctl dev"; - }else{ + } else { socket_close($SME_MARKER_SOCK_OR_CTL); #echo "Sent BE, closing socket"; } @@ -872,14 +871,14 @@ function waitForKernelACK($sock, $dummy_server_ip, $dummy_server_port){ return; } - if (isset($wgSMEStats) && $wgSMEStats){ + if (isset($wgSMEStats) && $wgSMEStats) { $time_start = microtime(true); } $ret = socket_recvfrom($sock, $ackbuf, 8, 0, $dummy_server_ip, $dummy_server_port); - if (isset($wgSMEStats) && $wgSMEStats){ + if (isset($wgSMEStats) && $wgSMEStats) { $time_end = microtime(true); $time = $time_end - $time_start; file_put_contents("/local/sme/stats_marker_sync.txt", -- GitLab