Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more tests stressing conccurent reading and writing on utp socket #474

Merged
merged 3 commits into from
Feb 10, 2022

Conversation

KonradStaniec
Copy link
Contributor

No description provided.

@KonradStaniec KonradStaniec marked this pull request as ready for review February 8, 2022 15:08
@@ -287,7 +288,7 @@ const
allowedAckWindow*: uint16 = 3

# Timeout after which the send window will be reset to its minimal value after it dropped
# to zero. i.e when we received a packet from remote peer with `wndSize` set to 0.
# belwo our current packet size. i.e when we received a packet from remote peer with `wndSize` set to number <= current packet size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# belwo our current packet size. i.e when we received a packet from remote peer with `wndSize` set to number <= current packet size
# a value lower than our current packet size. i.e when we received a packet from remote peer with `wndSize` set to number <= current packet size

@@ -0,0 +1,231 @@
# Copyright (c) 2020-2021 Status Research & Development GmbH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (c) 2020-2021 Status Research & Development GmbH
# Copyright (c) 2022 Status Research & Development GmbH

except CancelledError as exc:
# write loop has been cancelled in the middle of processing due to the
# socket closing
# this approach can create partial write in case destroyin socket in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# this approach can create partial write in case destroyin socket in the
# this approach can create partial write in when destroying the socket in the

bytesWritten = bytesWritten + len(dataSlice)
i = lastOrEnd + 1

# Before completeing future with success (as all data was sent sucessfuly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Before completeing future with success (as all data was sent sucessfuly)
# Before completing the future with success (as all data was sent successfully)

@@ -78,6 +80,7 @@ proc new*(
address: TransportAddress,
socketConfig: SocketConfig = SocketConfig.init(),
allowConnectionCb: AllowConnectionCallback[TransportAddress] = nil,
sendCallbackBuilder: SendCallbackBuilder = nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this sendCallbackBuilder needed? Is it just to have access to maxDelay: int, packetDropRate: int in the test cases? Would that not work also when build outside of the utp code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it is here so user of the library can augment send callback. Currently it is used only in tests to pass maxDelay: int, packetDropRate: int so that we can simulate delays and dropping packets but in theory one could add some application specific logic like logging or metrics for each send.

I think there could be the way to generalize it a bit and make it possible to build it outside utp and pass it as param, but this approach was a little bit simpler to implement.

@KonradStaniec KonradStaniec merged commit 779d767 into master Feb 10, 2022
@KonradStaniec KonradStaniec deleted the additional-utp-tests branch February 10, 2022 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants