Ejemplo n.º 1
0
 function MCVE_Monitor(&$conn)
 {
     return M_Monitor($conn);
 }
Ejemplo n.º 2
0
 function M_TransSend(&$conn, $id)
 {
     $tran =& M_findtranbyid($conn, $id);
     /* Invalid ptr, or transaction has already been sent out */
     if ($tran === false || $tran['status'] != M_TRAN_STATUS_NEW) {
         return false;
     }
     $tran['status'] = M_TRAN_STATUS_SENT;
     /* Structure Transaction */
     /* STX, identifier, FS */
     $tran_str = "" . $tran['id'] . "";
     /* PING is specially formed */
     if (isset($tran['in_params']['action']) && strcasecmp($tran['in_params']['action'], "ping") == 0) {
         $tran_str .= "PING";
     } else {
         /* Each key/value pair in array as key="value" */
         foreach ($tran['in_params'] as $key => $value) {
             $tran_str .= $key . '="' . str_replace('"', '""', $value) . '"' . "\r\n";
         }
         /* Add timeout if necessary */
         if ($conn['timeout'] != 0) {
             $tran_str .= 'timeout="' . $conn['timeout'] . '"' . "\r\n";
         }
     }
     /* ETX */
     $tran_str .= "";
     $conn['writebuf'] .= $tran_str;
     if ($conn['blocking']) {
         while (M_CheckStatus($conn, $id) == M_PENDING) {
             if (!M_Monitor($conn, -1)) {
                 return false;
             }
         }
     }
     return true;
 }