-
Notifications
You must be signed in to change notification settings - Fork 80
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
MDP sockets support (suite) #53
base: development
Are you sure you want to change the base?
Conversation
There is no reason for this variable to be external. It is used in init() and was used in done(), but the unlink() in done() is useless: it was already called on init() so the file was already unlinked.
Provide MDP sockets instead of using a global one.
I removed the definition of mdp_client_socket, but an external declaration was remaining.
lookup_send_request() must use the socket of the caller, not create a new one (detected by dnaprotocol test script).
Else, once the buffer is full, we get errno=11
ReleaseByteArrayElements last parameter is mode. Its value is: - 0: copy back the content and free the buffer; - JNI_COMMIT: copy back the content and *do not* free the buffer; - JNI_ABORT: free the buffer without copying back the possible changes. We definitely want 0. With JNI_COMMIT, after receiving more than ~1024 packets, it crashes: ReferenceTable overflow (max=1024)
Conflicts: commandline.c mdp_client.c serval.h sourcefiles.mk
(unused, signed/unsigned variables...)
Using fd+1 is the right way to use select()
Avoid to keep a lot of useless files like: var/serval-node/mdp-client-XXXX-XXXXXXXX.socket
If serval does not close properly, socket files are kept in /data/data/org.servalproject/var/serval-node. Therefore, we need to clean up when servald starts.
Conflicts: mdp_client.c
Makes any blocking recv exit
Blocking recv calls return a special return code (-2) for notifying the socket is closed (this information is useful for MDP socket users). This implementation is unsatisfactory: return code should instead be consistent with recvfrom(), that is always returning the length of received data (0 for socket closed).
Conflicts: commandline.c mdp_client.c serval.h
Avoid to open/close it if something goes wrong early.
I merged your new commits into I passed the Thus, you should be able to merge in and test without any merge conflicts. |
To run the directory_service tests, you must explicitly make the
|
I propose we pull this work into servalproject, and leave it as a feature branch called mdpsock until we have developed some unit tests for the MDP client library, which must pass before merging into mainline development. The tests will have to cover:
|
Thank you. I did it and discovered it was not compiling because it didn't use MDP sockets. |
Conflicts: commandline.c mdp_client.c serval.h
Conflicts: commandline.c mdp_client.c serval.h
I've fetched your branch and rebased it onto our development branch. Squashing, editing and reordering the various changes into a more structured and logical patch series. |
Great.
OK, I used the same pull request because if I had created a new one, GitHub would have included all the commits from the first one (so it would have been more confusing). However, some JNI bindings commits are already included in your
As these changes are client-side, I think there is nothing special to do. |
62ce14f
to
463e276
Compare
As this pull request has been closed due to branch renaming, I open a new one.
I just fixed a deadlock issue on the Java part.
But a problem persisted: if a thread would
close()
a socket, any blockingreceive()
would not exit as expected. Callingshutdown()
instead ofclose()
fixes the problem (commit f93642c).As it is worth knowing a blocking
receive()
has failed due to socketclose()
, commit 8d2ce4b gives the information to the caller (in exception message, like JavaDatagramSocket
does).Waiting for your feedbacks...