djgroen / mpwide Goto Github PK
View Code? Open in Web Editor NEWMPWide is a communication library for message passing across wide area networks.
License: GNU Lesser General Public License v3.0
MPWide is a communication library for message passing across wide area networks.
License: GNU Lesser General Public License v3.0
The status of C ::send and ::recv is read as an int, but if the buffer size is larger than that, it will deduce there is an error when there is not. In pseudo-code:
char *buf, long long int size;
int status = ::send(buf, size);
if (status < 0)
report_error();
However, if size
is larger than MAX_INT
and this is successfully returned by ::send
, status
will be smaller than zero through casting.
I think its reasonable to assume that the input size
should be an int, or that ::send
will always return less than MAX_INT, but maybe an explicit comment about these assumptions would be good.
When cout is called in multiple threads it is possible that its internal data structures are corrupted. It seems to have been solved in C++11 ( http://stackoverflow.com/a/6374525/574082 ). Locally I'm compiling against C++98/C++03 to keep compatibility with older versions of GCC.
If MPW_ConnectPath(pathId, false) would timeout, it would be easier to handle exceptions with connecting
After a connect has failed and you try to free the resources you get a segmentation fault in DestroyPath
->EraseStream
if the path had multiple streams. I think the problem is that DestroyPath
doesn't take into account that the stream numbers will change after calling EraseStream
.
I'll try to write a patch ASAP.
This would allow error checking by the calling application. Just returning -1 is usually enough. I think a ::recv
status of 0 should also be considered an error if it was successfully ::select
-ed. From the recv()
man page
RETURN VALUES
These calls return the number of bytes received, or -1 if an error
occurred.
For TCP sockets, the return value 0 means the peer has closed its half
side of the connection.
Possible trouble:
Segmentation fault in reading a vector in SendRecv while it is being resized.
Possible solution:
Turn vector data structures that are modified in AddStreams into arrays. This way the arrays do have to be allocated when MPWide is started (compiled), but it saves a load of trouble because they are then immutable. It is then up to users to set a sensible maximum number of streams to be used within a single session.
Why is this, and how can we solve it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.