-
Notifications
You must be signed in to change notification settings - Fork 31
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
Conversation
eth/utp/utp_socket.nim
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright (c) 2020-2021 Status Research & Development GmbH | |
# Copyright (c) 2022 Status Research & Development GmbH |
eth/utp/utp_socket.nim
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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 |
eth/utp/utp_socket.nim
Outdated
bytesWritten = bytesWritten + len(dataSlice) | ||
i = lastOrEnd + 1 | ||
|
||
# Before completeing future with success (as all data was sent sucessfuly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
No description provided.