Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen committed Sep 4, 2023
1 parent d4aa9ae commit 7dbc1a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

[Parameter(HelpMessage="Tests to run")]
[string]
$TestsToRun = 'libponyrt.tests,libponyc.tests,libponyc.run.tests.debug,libponyc.run.tests.release,stdlib-debug,stdlib-release,grammar'
$TestsToRun = 'stdlib-debug,stdlib-release'
)

$srcDir = Split-Path $script:MyInvocation.MyCommand.Path
Expand Down
26 changes: 13 additions & 13 deletions packages/net/_test.pony
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ actor \nodoc\ Main is TestList
// Tests below function across all systems and are listed alphabetically
test(_TestTCPConnectionFailed)
test(_TestTCPExpect)
// test(_TestTCPExpectOverBufferSize)
test(_TestTCPExpectOverBufferSize)
test(_TestTCPMute)
// test(_TestTCPProxy)
test(_TestTCPProxy)
test(_TestTCPUnmute)
// test(_TestTCPWritev)
test(_TestTCPWritev)

// Tests below exclude windows and are listed alphabetically
ifdef not windows then
Expand All @@ -22,9 +22,9 @@ actor \nodoc\ Main is TestList
end

// Tests below exclude osx and are listed alphabetically
/*ifdef not osx then
ifdef not osx then
test(_TestBroadcast)
end*/
end

class \nodoc\ _TestPing is UDPNotify
let _h: TestHelper
Expand Down Expand Up @@ -134,7 +134,7 @@ class \nodoc\ iso _TestBroadcast is UnitTest
h.dispose_when_done(
UDPSocket(UDPAuth(h.env.root), recover _TestPong(h) end))

h.long_test(300_000_000_000)
h.long_test(30_000_000_000)

fun ref timed_out(h: TestHelper) =>
h.log("""
Expand Down Expand Up @@ -168,7 +168,7 @@ class \nodoc\ _TestTCP is TCPListenNotify
h.dispose_when_done(TCPListener.ip4(TCPListenAuth(h.env.root), consume this, "127.0.0.1", port))
h.complete_action("server create")

h.long_test(300_000_000_000)
h.long_test(30_000_000_000)

fun ref not_listening(listen: TCPListener ref) =>
_h.fail_action("server listen")
Expand Down Expand Up @@ -247,7 +247,7 @@ class \nodoc\ _TestTCPExpectNotify is TCPConnectionNotify

fun ref accepted(conn: TCPConnection ref) =>
@printf("connection accepted by _TestTCPExpectNotify %p\n".cstring(), conn)
//conn.set_nodelay(true)
conn.set_nodelay(true)
try
conn.expect(_expect)?
_send(conn, "hi there")
Expand All @@ -260,7 +260,7 @@ class \nodoc\ _TestTCPExpectNotify is TCPConnectionNotify

fun ref connected(conn: TCPConnection ref) =>
_h.complete_action("client connect")
//conn.set_nodelay(true)
conn.set_nodelay(true)
try
conn.expect(_expect)?
else
Expand Down Expand Up @@ -333,7 +333,7 @@ class \nodoc\ _TestTCPExpectOverBufferSizeNotify is TCPConnectionNotify

fun ref accepted(conn: TCPConnection ref) =>
@printf("connection accepted by _TestTCPExpectOverBufferSizeNotify %p\n".cstring(), conn)
//conn.set_nodelay(true)
conn.set_nodelay(true)
try
conn.expect(_expect)?
_h.fail("expect didn't error out")
Expand All @@ -343,7 +343,7 @@ class \nodoc\ _TestTCPExpectOverBufferSizeNotify is TCPConnectionNotify

fun ref connected(conn: TCPConnection ref) =>
_h.complete_action("client connect")
//conn.set_nodelay(true)
conn.set_nodelay(true)
try
conn.expect(_expect)?
_h.fail("expect didn't error out")
Expand Down Expand Up @@ -713,7 +713,7 @@ class \nodoc\ _TestTCPConnectionFailed is UnitTest
end,
host,
port)
h.long_test(300_000_000_000)
h.long_test(30_000_000_000)
h.dispose_when_done(connection)

class \nodoc\ _TestTCPConnectionToClosedServerFailed is UnitTest
Expand Down Expand Up @@ -760,7 +760,7 @@ class \nodoc\ _TestTCPConnectionToClosedServerFailed is UnitTest
)

h.dispose_when_done(listener)
h.long_test(300_000_000_000)
h.long_test(30_000_000_000)

actor \nodoc\ _TCPConnectionToClosedServerFailedConnector
be connect(h: TestHelper, host: String, port: String) =>
Expand Down
2 changes: 0 additions & 2 deletions packages/net/tcp_connection.pony
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,6 @@ actor TCPConnection is AsioEventNotify
// On windows, this will also cancel all outstanding IOCP operations.
@printf("%p closing socket %d\n".cstring(), this, _fd)
@pony_os_socket_close(_fd)
// TODO SEAN
@pony_os_socket_shutdown(_fd)
_fd = -1

_notify.closed(this)
Expand Down
14 changes: 2 additions & 12 deletions src/libponyrt/lang/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,18 +1132,8 @@ PONY_API void pony_os_socket_shutdown(int fd)
PONY_API void pony_os_socket_close(int fd)
{
#ifdef PLATFORM_IS_WINDOWS
if (CancelIoEx((HANDLE)(UINT_PTR)fd, NULL) == 0) {
printf("CancelIoEx failed\n");
printf("pony os socket close error: %ld\n", GetLastError());
} else {
printf("CancelIOEx good\n");
}
printf("closing socket %d\n", fd);
if (closesocket((SOCKET)fd) != 0) {
printf("close socket error: %ld\n", WSAGetLastError());
} else {
printf("close socket good\n");
}
CancelIoEx((HANDLE)(UINT_PTR)fd, NULL);
closesocket((SOCKET)fd);
#else
close(fd);
#endif
Expand Down

0 comments on commit 7dbc1a4

Please sign in to comment.