rickysu / hhvm-ext-uv Goto Github PK
View Code? Open in Web Editor NEWHHVM libuv extension
License: MIT License
HHVM libuv extension
License: MIT License
In file included from /steel/Sources/hhvm-ext-uv/src/ext.h:6:0,
from /steel/Sources/hhvm-ext-uv/src/ext.cpp:1:
/steel/Sources/hhvm-ext-uv/src/util.h: In function ‘HPHP::ObjectData* HPHP::makeObject(const HPHP::String&, HPHP::Array, bool)’:
/steel/Sources/hhvm-ext-uv/src/util.h:18:53: error: conversion from ‘HPHP::ObjectData*’ to non-scalar type ‘HPHP::Object’ requested
Object o = ret = ObjectData::newInstance(cls);
^
CMakeFiles/uv.dir/build.make:54: recipe for target 'CMakeFiles/uv.dir/src/ext.cpp.o' failed
make[2]: *** [CMakeFiles/uv.dir/src/ext.cpp.o] Error 1
CMakeFiles/Makefile2:161: recipe for target 'CMakeFiles/uv.dir/all' failed
make[1]: *** [CMakeFiles/uv.dir/all] Error 2
Makefile:107: recipe for target 'all' failed
make: *** [all] Error 2
<?h
class AsyncRedis{
public UVTcp $Connection;
public bool $Status = false;
public function __construct(string $Host, int $Port){
$this->Connection = new UVTcp();
$this->Connection->connect($Host, $Port, function(){
$this->Status = true;
echo 'Exit';
});
$this->Connection->setCallback(function($Data){
echo $Data."\n";
}, function(){
}, function(){
});
$this->Connection->write("asd");
}
}
$Redis = new AsyncRedis('localhost', 6379);
UVLoop::defaultLoop()->run();
hhvm: src/unix/stream.c:1489: uv_read_start: Assertion `((stream)->io_watcher.fd) >= 0' failed.
Segmentation fault (core dumped)
Currently it supports TCP connections, would be nicer to have unix socket support as well.
In file included from /anees/Sources/hhvm-ext-uv/src/ext.h:6:0,
from /anees/Sources/hhvm-ext-uv/src/ext.cpp:1:
/anees/Sources/hhvm-ext-uv/src/util.h: In function ‘int HPHP::resource_to_fd(const HPHP::Resource&)’:
/anees/Sources/hhvm-ext-uv/src/util.h:39:40: error: cannot convert ‘HPHP::SmartPtr<HPHP::File>’ to ‘HPHP::File*’ in initialization
File *file = fd.getTyped<File>();
^
/anees/Sources/hhvm-ext-uv/src/util.h:43:44: error: cannot convert ‘HPHP::SmartPtr<HPHP::Socket>’ to ‘HPHP::Socket*’ in initialization
Socket *sock = fd.getTyped<Socket>();
^
CMakeFiles/uv.dir/build.make:54: recipe for target 'CMakeFiles/uv.dir/src/ext.cpp.o' failed
make[2]: *** [CMakeFiles/uv.dir/src/ext.cpp.o] Error 1
CMakeFiles/Makefile2:161: recipe for target 'CMakeFiles/uv.dir/all' failed
make[1]: *** [CMakeFiles/uv.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
[07:08 PM] steel@Black-Beauty [/anees/Sources/hhvm-ext-uv] {master} $ hhvm --version
HipHop VM 3.8.0 (rel)
Compiler: tags/HHVM-3.8.0-0-gbb32f8d645b28561d8491870c44730b9b3f08d35
Repo schema: 74bee5d310450724cfd49245fd6c2e1e4323b10a
In Node, the read function is triggered quite frequently but I see that in Hack, the read callback is only triggered once. so my question is, is this extension buffering the data? If it's buffering, can we specify a buffering limit? so people can't flood our ram with infinite data.
I am not quite experienced with UV yet, but I've found it great so far, but I still don't know how to keep the loop alive, maybe your experience can help me?
<?php
echo "One\n";
$Timer = new UVTimer();
$Timer->start(function(){
echo "Three\n";
}, 0);
echo "TWo\n";
UVLoop::defaultLoop()->run();
echo "One\n";
$Timer = new UVTimer();
$Timer->start(function(){
echo "Three";
}, 0);
echo "TWo\n";
Here's a minimal repro of what I am trying to do, I am writing a UV based async Promise library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.