Skip to content

Commit dbd3350

Browse files
committed
Don't listen in listen
1 parent b118453 commit dbd3350

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

libraries/common/io/network.effekt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def close(handle: Connection): Unit / Exception[IOError] = {
2424
/// A tcp listener. Should not be inspected.
2525
type Listener = Int
2626

27-
def listen(host: String, port: Int, backlog: Int): Listener / Exception[IOError] =
28-
internal::checkResult(internal::listen(host, port, backlog))
27+
def listen(host: String, port: Int): Listener / Exception[IOError] =
28+
internal::checkResult(internal::listen(host, port))
2929

3030
def accept(listener: Listener, handler: Connection => Unit at {io, async, global}): Unit / Exception[IOError] = {
3131
internal::checkResult(internal::accept(listener, handler)); ()
@@ -73,9 +73,9 @@ namespace internal {
7373
ret void
7474
"""
7575

76-
extern async def listen(host: String, port: Int, backlog: Int): Int =
76+
extern async def listen(host: String, port: Int): Int =
7777
llvm """
78-
call void @c_tcp_listen(%Pos ${host}, %Int ${port}, %Int ${backlog}, %Stack %stack)
78+
call void @c_tcp_listen(%Pos ${host}, %Int ${port}, %Stack %stack)
7979
ret void
8080
"""
8181

libraries/llvm/io.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void c_tcp_close(Int handle, Stack stack) {
317317
uv_close(uv_handle, c_tcp_close_cb);
318318
}
319319

320-
void c_tcp_listen(String host, Int port, Int backlog, Stack stack) {
320+
void c_tcp_listen(String host, Int port, Stack stack) {
321321
// TODO make non-async
322322
char* host_str = c_bytearray_into_nullterminated_string(host);
323323
erasePositive(host);
@@ -349,13 +349,6 @@ void c_tcp_listen(String host, Int port, Int backlog, Stack stack) {
349349
return;
350350
}
351351

352-
result = uv_listen((uv_stream_t*)tcp_handle, backlog, NULL);
353-
if (result < 0) {
354-
uv_close((uv_handle_t*)tcp_handle, (uv_close_cb)free);
355-
resume_Int(stack, result);
356-
return;
357-
}
358-
359352
resume_Int(stack, (int64_t)tcp_handle);
360353
}
361354

0 commit comments

Comments
 (0)