Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix net.can example

  • Loading branch information...
commit 1e1ad065dd3dcb9f82638b58252c827996af049f 1 parent ef0ebb7
@creationix creationix authored
Showing with 3 additions and 4 deletions.
  1. +2 −3 net.can
  2. +1 −1  src/luv_stream.cc
View
5 net.can
@@ -39,18 +39,16 @@ ClientPrototype.end = (self) {
ServerPrototype = {}
ServerPrototype.listen = (self, port, host, callback) {
- p("ServerPrototype.listen", self, port, host, callback)
if (!host) host = "0.0.0.0"
check(self.socket:bind(host, port))
check(self.socket:listen(128, (status) {
check(status)
client = new ClientPrototype
- client.socket = socket
socket = Tcp.create()
+ client.socket = socket
check(self.socket:accept(socket))
self.onConnection(client)
check(socket:readStart((nread, chunk) {
- p("onRead", nread, chunk)
if (nread == -1) {
err = require('uv').lastError()
if (err.name == "EOF") {
@@ -81,6 +79,7 @@ createServer = function (onConnection) {
// Make an echo server using the API
server = createServer((client) {
+ print("new client, piping data back to it")
client:pipe(client)
}):listen(8080)
print("TCP echo server listening on port 8080")
View
2  src/luv_stream.cc
@@ -129,7 +129,7 @@ static Value* luv_write(uint32_t argc, Value* argv[]) {
buf->len = len;
buf->base = (char*)chunk;
if (argc == 3) {
- assert(argv[2]->Is<Function>());
+ // assert(argv[2]->Is<Function>());
// TODO: store callback somehow;
}
uv_write_t* req = new uv_write_t;
Please sign in to comment.
Something went wrong with that request. Please try again.