Browse files

Minor fixes

  • Loading branch information...
1 parent df85d1a commit ef0ebb746aab371caf4d51242e4e418ccdc73d6b @creationix creationix committed Mar 22, 2012
Showing with 3 additions and 7 deletions.
  1. +0 −1 Makefile
  2. +3 −6 net.can
View
1 Makefile
@@ -15,7 +15,6 @@ LIBS=build/main.o \
build/cio.o \
build/cio_string.o \
build/luv.o \
- build/luv_misc.o \
build/luv_handle.o \
build/luv_stream.o \
build/luv_tcp.o \
View
9 net.can
@@ -42,14 +42,15 @@ 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.listen(128, (status) {
+ check(self.socket:listen(128, (status) {
check(status)
client = new ClientPrototype
client.socket = socket
socket = Tcp.create()
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,9 +82,5 @@ createServer = function (onConnection) {
// Make an echo server using the API
server = createServer((client) {
client:pipe(client)
-})
-ServerPrototype.listen(1)
-ServerPrototype.listen(1, 2)
-ServerPrototype.listen(1, 2, 3)
-ServerPrototype.listen(1, 2, 3, 4)
+}):listen(8080)
print("TCP echo server listening on port 8080")

0 comments on commit ef0ebb7

Please sign in to comment.