push byzantine prevote message of temp gossip, don't consider isValid, don't push received_addresses isApproved: 1 approved ; 0 opposed
194846
function pushByzantinePrevoteTemp(h, p, idv, address, isApproved) {
    if(address !== null ){
        // mutex.lock( [ "assocByzantinePhase["+h+"].phase["+p+"]" ], function( unlock ){
            if(!assocByzantinePhase[h].phase[p] || 
                typeof assocByzantinePhase[h].phase[p] === 'undefined' || 
                Object.keys(assocByzantinePhase[h].phase[p]).length === 0){
                assocByzantinePhase[h].phase[p] =  {"proposal":{}, "received_addresses":[],
                "prevote_approved":[], "prevote_opposed":[], "prevote_temp_gossip":{},
                "precommit_approved":[], "precommit_opposed":[], "precommit_temp_gossip":{}};     
            }
            if(assocByzantinePhase[h].phase[p].prevote_approved.indexOf(address) === -1 && assocByzantinePhase[h].phase[p].prevote_opposed.indexOf(address) === -1){
                // console.log("byllllogg BYZANTINE_PREVOTE:" +h + p + "-4-idv:"+idv + "-pidv:" + assocByzantinePhase[h].phase[p].proposal.idv + "-address:" 
                    // + address+"-isApproved:"+isApproved+":"+(isApproved === 1)+ (assocByzantinePhase[h].phase[p].proposal.idv === idv));
                if(isApproved === 1 && assocByzantinePhase[h].phase[p].proposal.idv === idv){  
                    // console.log("byllllogg BYZANTINE_PREVOTE:" +h + p + "-5-idv:"+idv + "-address:" + address+"-isApproved:"+isApproved);
                    assocByzantinePhase[h].phase[p].prevote_approved.push(address);
                }
                else{
                    // console.log("byllllogg BYZANTINE_PREVOTE:" +h + p + "-6-idv:"+idv + "-address:" + address+"-isApproved:"+isApproved);
                    assocByzantinePhase[h].phase[p].prevote_opposed.push(address);
                }
            }
        //     unlock();
        // });
    }   
}
178377
def _push_broks(self):
        
        data = cherrypy.request.json
        with self.app.arbiter_broks_lock:
            logger.debug("Pushing %d broks", len(data['broks']))
            self.app.arbiter_broks.extend([unserialize(elem, True) for elem in data['broks']])
240369
def upvote
      security_transgression_unless @comment.can_be_voted_on_by?(@user)

      @comment.upvote_from @user

      respond_to do |format|
        format.html { redirect_to @thread }
        format.js { render :vote }
      end
    end
383370
def poll_from source, opts={}
    debug "trying to acquire poll lock for: #{source}..."
    if source.try_lock
      begin
        source.poll do |sym, args|
          case sym
          when :add
            m = Message.build_from_source source, args[:info]
            old_m = Index.build_message m.id
            m.labels += args[:labels]
            m.labels.delete :inbox  if source.archived?
            m.labels.delete :unread if source.read?
            m.labels.delete :unread if m.source_marked_read? # preserve read status if possible
            m.labels.each { |l| LabelManager << l }
            m.labels = old_m.labels + (m.labels - [:unread, :inbox]) if old_m
            m.locations = old_m.locations + m.locations if old_m
            HookManager.run "before-add-message", :message => m
            yield :add, m, old_m, args[:progress] if block_given?
            Index.sync_message m, true

            if Index.message_joining_killed? m
              m.labels += [:killed]
              Index.sync_message m, true
            end

            ## We need to add or unhide the message when it either did not exist
            ## before at all or when it was updated. We do *not* add/unhide when
            ## the same message was found at a different location
            if old_m
              UpdateManager.relay self, :updated, m
            elsif !old_m or not old_m.locations.member? m.location
              UpdateManager.relay self, :added, m
            end
          when :delete
            Index.each_message({:location => [source.id, args[:info]]}, false) do |m|
              m.locations.delete Location.new(source, args[:info])
              Index.sync_message m, false
              if m.locations.size == 0
                yield :delete, m, [source,args[:info]], args[:progress] if block_given?
                Index.delete m.id
                UpdateManager.relay self, :location_deleted, m
              end
            end
          when :update
            Index.each_message({:location => [source.id, args[:old_info]]}, false) do |m|
              old_m = Index.build_message m.id
              m.locations.delete Location.new(source, args[:old_info])
              m.locations.push Location.new(source, args[:new_info])
              ## Update labels that might have been modified remotely
              m.labels -= source.supported_labels?
              m.labels += args[:labels]
              yield :update, m, old_m if block_given?
              Index.sync_message m, true
              UpdateManager.relay self, :updated, m
            end
          end
        end

      rescue SourceError => e
        warn "problem getting messages from #{source}: #{e.message}"

      ensure
        source.go_idle
        source.unlock
      end
    else
      debug "source #{source} is already being polled."
    end
  end
565682
def approvewitness(self, witnesses, account=None, **kwargs):
        
        if not account:
            if "default_account" in self.config:
                account = self.config["default_account"]
        if not account:
            raise ValueError("You need to provide an account")
        account = Account(account, blockchain_instance=self)
        options = account["options"]

        if not isinstance(witnesses, (list, set, tuple)):
            witnesses = {witnesses}

        for witness in witnesses:
            witness = Witness(witness, blockchain_instance=self)
            options["votes"].append(witness["vote_id"])

        options["votes"] = list(set(options["votes"]))
        options["num_witness"] = len(
            list(filter(lambda x: float(x.split(":")[0]) == 1, options["votes"]))
        )

        op = operations.Account_update(
            **{
                "fee": {"amount": 0, "asset_id": "1.3.0"},
                "account": account["id"],
                "new_options": options,
                "extensions": {},
                "prefix": self.prefix,
            }
        )
        return self.finalizeOp(op, account["name"], "active", **kwargs)
987960
function pushByzantinePrecommit(h, p, idv, address, sig, isApproved) {
    var ifIncluded = false;
    // mutex.lock( [ "assocByzantinePhase["+h+"].phase["+p+"]" ], function( unlock ){
        if(!assocByzantinePhase[h].phase[p] || 
            typeof assocByzantinePhase[h].phase[p] === 'undefined' || 
            Object.keys(assocByzantinePhase[h].phase[p]).length === 0){
            assocByzantinePhase[h].phase[p] = {"proposal":{}, "received_addresses":[],
             "prevote_approved":[], "prevote_opposed":[], "prevote_temp_gossip":{},
             "precommit_approved":[], "precommit_opposed":[], "precommit_temp_gossip":{}};   
        }
        else{
            for (var j=0; j<assocByzantinePhase[h].phase[p].precommit_approved.length; j++){
                if(sig && assocByzantinePhase[h].phase[p].precommit_approved[j] && assocByzantinePhase[h].phase[p].precommit_approved[j].address === sig.address){
                    ifIncluded = true;
                    break;
                }
            }
        }
        if(address !== null && !ifIncluded && assocByzantinePhase[h].phase[p].precommit_opposed.indexOf(address) === -1){
            if(isApproved === 1 && sig !== null && sig.address !== null && sig.address === address 
                && assocByzantinePhase[h].phase[p].proposal.idv === idv && assocByzantinePhase[h].phase[p].proposal.isValid === 1){
                assocByzantinePhase[h].phase[p].precommit_approved.push(sig);
            }
            // else if (isApproved === 0){  // ???
            else {  
                assocByzantinePhase[h].phase[p].precommit_opposed.push(address);
            }
            pushReceivedAddresses(assocByzantinePhase[h].phase[p].received_addresses, address);
        }    
        // unlock();
    // });
}
1350297
function pushIps(addresses, announced, useInternalAddresses) {
	if (!useInternalAddresses) {
		addresses = addresses.filter((address) => address.internal === false);
	}

	addresses = addresses
		.filter((address) => address.family === 'IPv4')
		.map((address) => address.address);

	return announced.concat(addresses);
}
1172286
def _on_socket_push_updates(self, resp):
        
        # TODO: check to make sure resp['meta']['bundleid']==bundleid ?
        # TODO: handle added parameters
        # TODO: handle removed (isDeleted) parameters

        for item in resp['data']:
            if item['id'] in self.uniqueids:
                # then we're updating something in the parameter (or deleting)
                param = self.get_parameter(uniqueid=item['id'])
                for attr, value in item['attributes'].items():
                    if hasattr(param, "_{}".format(attr)):
                        logger.info("updates from server: setting {}@{}={}".
                                    format(attr, param.twig, value))
                        setattr(param, "_{}".format(attr), value)
            else:
                self._attach_param_from_server(item)
212001
def _reallysend(self, payload, token, expiration=None, priority=None, identifier=None):
        

        if not self.alive:
            raise ConnectionDeadException()
        if not self.useable:
            raise ConnectionDeadException()
        seq = self._nextSeq()
        if seq >= PushConnection.MAX_PUSHES_PER_CONNECTION:
            # IDs are 4 byte so rather than worry about wrapping IDs, just make a new connection
            # Note we don't close the connection because we want to wait to see if any errors arrive
            self._retire_connection()

        payload_str = json_for_payload(truncate(payload))
        items = ''
        items += self._apns_item(PushConnection.ITEM_DEVICE_TOKEN, token)
        items += self._apns_item(PushConnection.ITEM_PAYLOAD, payload_str)
        items += self._apns_item(PushConnection.ITEM_IDENTIFIER, seq)
        if expiration:
            items += self._apns_item(PushConnection.ITEM_EXPIRATION, expiration)
        if priority:
            items += self._apns_item(PushConnection.ITEM_PRIORITY, priority)

        apnsFrame = struct.pack("!BI", PushConnection.COMMAND_SENDPUSH, len(items)) + items

        try:
            written = 0
            while written < len(apnsFrame):
                written += self.sock.send(apnsFrame[written:])
        except:
            logger.exception("Caught exception sending push")
            raise
        self.sent[seq] = PushConnection.SentMessage(
            time.time(), token, payload, expiration, priority, identifier
        )
        self.last_push_sent = time.time()
1326265
async function sendApproveZero() {

  console.log('Starting erc20 outbound', opts);

  // Get the raw approve tx with 0 value
  const approveTx = cctx.buildApproveTx(Object.assign({}, opts, { value: '0' }));

  // Send the approve transaction on Wanchain
  const receipt = await utils.sendRawWanTx(web3wan, approveTx, opts.from, wanPrivateKey);

  console.log('Token approval removed');
  console.log(receipt);
}
1372388
def post(self, request, *args, **kwargs):
        
        return self.approve(request, *args, **kwargs)
898458
def tempdeny(ip=None, ttl=None, port=None, direction=None, comment=''):
    '''
    
    '''
    return _tmp_access_rule('tempdeny', ip, ttl, port, direction, comment)
1010993
def reject!(connected_at, code, reason)
      self.update_node!(connected_at,
        connected: false,
        updated: false,
        websocket_connection: {
          opened: false,
          close_code: code,
          close_reason: reason,
        },
      )
      info "Rejected connection for node #{@node.to_path} at #{connected_at} with code #{code}: #{reason}"
    rescue => exc
      error exc
    end
813868
def confirm_push(self, coord, version):
    """"""
    if not self.get_options().prompt:
      return True
    try:
      isatty = os.isatty(sys.stdin.fileno())
    except ValueError:
      # In tests, sys.stdin might not have a fileno
      isatty = False
    if not isatty:
      return True
    push = input('\nPublish {} with revision {} ? [y|N] '.format(
      coord, version
    ))
    print('\n')
    return push.strip().lower() == 'y'
416750
def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)
      private_url("PUT", object_key, temp_url_key, expires_at)
    end
1040209
def post(self, request, *args, **kwargs):
        
        return self.disapprove(request, *args, **kwargs)
860749
function gossiperOnReceivedMessage( oWs, oMessage )
{
	try
	{
		_oGossiper.onReceivedMessage( oWs, oMessage );
	}
	catch( oException )
	{
		console.error( `GOSSIPER ))) gossiperOnReceivedMessage occurred an exception: ${ JSON.stringify( oException ) }` );
	}
}