History log of /haiku/src/kits/network/libnetapi/NetEndpoint.cpp
Revision Date Author Comments
# 0ce3a760 01-Feb-2021 Jérôme Duval <jerome.duval@gmail.com>

libnetwork: handle EINTR on select() and poll()

Change-Id: I4e3562bd2564dd0c61142d0b467c81abd393373a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3726
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 2c9528d2 27-Sep-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

BNetEndpoint: improve timeout handling

Based on a patch by Duggan.

A timeout of 0 means "no timeout". Avoid an overflow case. Translate
B_INFINITE_TIMEOUT to a NULL timeout for select().

Fixes #7870


# 41a9299b 07-May-2014 Jessica Hamilton <jessica.l.hamilton@gmail.com>

BNetEndPoint: fix signedness issues. CID 604169.


# 840aeab5 22-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

NetEndpoint: Don't forget to close socket in error case. CID 1162792


# dcc56bf7 24-Nov-2013 Michael Lotz <mmlr@mlotz.ch>

BNetEndpoint: Fix socket leak and reduce Accept() overhead.

When using the copy constructor of BNetEndpoint the socket of the
original endpoint gets dup'ed. The Accept() method later directly reset
the fSocket member of the newly created BNetEndpoint to the socket
returned by accept(). The socket dup'ed by the copy constructor was
therefore leaked.

Of course dup'ing the socket and copying the local and remote addresses
is superfluous in the accept case, as these members all get set to new
values. To reduce that overhead there is now a new private constructor
that directly gets the final socket and remote and local address.


# 20270638 07-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added TODOs where IsDataPending() is called incorrectly. Since it has stupid
semantics, I'd recommend introducing an _IsDataPending() with sane semantics
and use that.
* IsDataPending() Added TODO regarding possible overflow.
* SetTimeout(): Added TODO regarding consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42009 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ace79831 07-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b37fa18b 08-Jul-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Fixed Size() and BytesRemaining() semantics, which was broken.
Revert r33437, which was missing the root cause.
Spotted by Christophe Huriaux, thanks.
And welcome in contributors list!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37437 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b69dfc85 05-Oct-2009 Bruno G. Albuquerque <bga@bug-br.org.br>

BnetEndPoint::Send() should use BytesRemaining() as the amount of data to be sent, not
Size(). This fixes #4724.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33437 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49a22456 13-Jul-2008 Oliver Tappe <zooey@hirschkaefer.de>

Overhauled BNetEndpoint implementation (and BNetAddress, too):
* added NetEndpointTest that exposed a couple of bugs
* fixed several bugs in the implementation of BNetEndpoint, some of which kept
NetPenguin from working
* fixed a couple of constness issues in BNetEndpoint and BNetAddress


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26405 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 07ddcd64 14-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed libnetapi to libbnetapi. Create a symlink in the image.
* Extended R5 compatibility check to also consider calls from
libbnetapi.
* Fixed incorrect R5 compatibility check in BNetEndpoint constructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25489 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6cde6beb 10-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed several issues pointed out by Olivier "Methe" Milla.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20645 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9828bbd 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* libnetapi.so should now work correctly in the R5 compatibility environment.
* Added a link from libbnetapi.so to libnetapi.so. We might think about moving
libnetapi.so into libnetwork.so as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19014 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 241b0480 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed build of libnetapi.so - it probably won't work for now, though, have a look
at the comment in r5_compatibility.h.
* Intentionally broke source compatibility and removed all that outdated Nettle stuff.
* Also, I took the liberty of making m_init private and rename it to fInit - again, this
will only affect source compatibility.
* Rewrote NetEndpoint.h
* Fixed quite a few small bugs around the code that I touched, for example in NetAddress,
SetTo() never set fInit, and therefore could be wrong.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18680 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fdccb80 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

Moved libnetapi.so sources into the src/kit/net/ directory - they don't yet build, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18678 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67b376e9 26-Nov-2005 Waldemar Kornewald <wkornew@nowhere.fake>

Moved our networking libraries to src/kits/network/compat. We want to have our own, clean libnetwork.so.

TODO: move all public networking headers to some other place (compat or headers/legacy?) and replace the current headers with clean versions from FreeBSD and BIND 9.3.1
TODO: remove R5 target support


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15169 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 758b1d0e 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 200ec026 13-Aug-2004 Philippe Houdoin <philippe.houdoin@gmail.com>

Remove const that breaks binary compatibility (const are mangled too).
Thanks axeld to point at them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8569 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c42f7bc 13-Aug-2004 Philippe Houdoin <philippe.houdoin@gmail.com>

Complete BNetEdnpoint implementation, based on Alexandre Bique contribution.
Fix sendto() and recvfrom() sockaddr length argument to int, not size_t.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8564 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f22e3ab 25-Oct-2002 beveloper <beveloper@nowhere.fake>

small change


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1659 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3dfda17 27-Aug-2002 Philippe Houdoin <philippe.houdoin@gmail.com>

Moving net kit libnet.so and libnetapi.so source code to /current.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 41a9299bb53670a6768c9f711189a43855ae283e 07-May-2014 Jessica Hamilton <jessica.l.hamilton@gmail.com>

BNetEndPoint: fix signedness issues. CID 604169.


# 840aeab5b9d0197fdfc50fa2f3b06e66b850f892 22-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

NetEndpoint: Don't forget to close socket in error case. CID 1162792


# dcc56bf748e948579a72e484633c6c9d86b01132 24-Nov-2013 Michael Lotz <mmlr@mlotz.ch>

BNetEndpoint: Fix socket leak and reduce Accept() overhead.

When using the copy constructor of BNetEndpoint the socket of the
original endpoint gets dup'ed. The Accept() method later directly reset
the fSocket member of the newly created BNetEndpoint to the socket
returned by accept(). The socket dup'ed by the copy constructor was
therefore leaked.

Of course dup'ing the socket and copying the local and remote addresses
is superfluous in the accept case, as these members all get set to new
values. To reduce that overhead there is now a new private constructor
that directly gets the final socket and remote and local address.


# 202706381e5072eea5877946e6986ef03eeb940b 07-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added TODOs where IsDataPending() is called incorrectly. Since it has stupid
semantics, I'd recommend introducing an _IsDataPending() with sane semantics
and use that.
* IsDataPending() Added TODO regarding possible overflow.
* SetTimeout(): Added TODO regarding consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42009 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ace79831155dd4e7d40989b718bba070729a9177 07-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b37fa18bdb610c1ce142106448ba0b5378a446d2 08-Jul-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Fixed Size() and BytesRemaining() semantics, which was broken.
Revert r33437, which was missing the root cause.
Spotted by Christophe Huriaux, thanks.
And welcome in contributors list!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37437 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b69dfc85c897ed25ce858f621a5e75cda7fb84e6 05-Oct-2009 Bruno G. Albuquerque <bga@bug-br.org.br>

BnetEndPoint::Send() should use BytesRemaining() as the amount of data to be sent, not
Size(). This fixes #4724.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33437 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49a22456ddda2a7cfc5c19d9ccc131125b8b690c 13-Jul-2008 Oliver Tappe <zooey@hirschkaefer.de>

Overhauled BNetEndpoint implementation (and BNetAddress, too):
* added NetEndpointTest that exposed a couple of bugs
* fixed several bugs in the implementation of BNetEndpoint, some of which kept
NetPenguin from working
* fixed a couple of constness issues in BNetEndpoint and BNetAddress


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26405 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 07ddcd64cfef3d135917011878bc7c2cb027b397 14-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed libnetapi to libbnetapi. Create a symlink in the image.
* Extended R5 compatibility check to also consider calls from
libbnetapi.
* Fixed incorrect R5 compatibility check in BNetEndpoint constructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25489 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6cde6beba788ca5c41f14d0ae6fd98386ef70080 10-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed several issues pointed out by Olivier "Methe" Milla.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20645 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9828bbd25e905031618c888c7c32b9f34a88cb3 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* libnetapi.so should now work correctly in the R5 compatibility environment.
* Added a link from libbnetapi.so to libnetapi.so. We might think about moving
libnetapi.so into libnetwork.so as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19014 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 241b048033e34efa942d1f43f8d199d086b07743 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed build of libnetapi.so - it probably won't work for now, though, have a look
at the comment in r5_compatibility.h.
* Intentionally broke source compatibility and removed all that outdated Nettle stuff.
* Also, I took the liberty of making m_init private and rename it to fInit - again, this
will only affect source compatibility.
* Rewrote NetEndpoint.h
* Fixed quite a few small bugs around the code that I touched, for example in NetAddress,
SetTo() never set fInit, and therefore could be wrong.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18680 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fdccb80f57f9386b43253be9278c40fd7d5cc26 28-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

Moved libnetapi.so sources into the src/kit/net/ directory - they don't yet build, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18678 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67b376e9539ff0b7cc4914c79c0976ffb96e6790 26-Nov-2005 Waldemar Kornewald <wkornew@nowhere.fake>

Moved our networking libraries to src/kits/network/compat. We want to have our own, clean libnetwork.so.

TODO: move all public networking headers to some other place (compat or headers/legacy?) and replace the current headers with clean versions from FreeBSD and BIND 9.3.1
TODO: remove R5 target support


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15169 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 758b1d0e05fe1042cce6e00d194a147802d4f9be 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 200ec0269e02ee0f2372b0f8db8bee2eb33cdf75 13-Aug-2004 Philippe Houdoin <philippe.houdoin@gmail.com>

Remove const that breaks binary compatibility (const are mangled too).
Thanks axeld to point at them.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8569 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c42f7bcf1de1e01c0ea53aee13eefbec266ebc4 13-Aug-2004 Philippe Houdoin <philippe.houdoin@gmail.com>

Complete BNetEdnpoint implementation, based on Alexandre Bique contribution.
Fix sendto() and recvfrom() sockaddr length argument to int, not size_t.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8564 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f22e3ab04ac6cfa6faebbed1c0139509cc89f9f 25-Oct-2002 beveloper <beveloper@nowhere.fake>

small change


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1659 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3dfda177957165c55cbe4d0b4386bc114f48e1c 27-Aug-2002 Philippe Houdoin <philippe.houdoin@gmail.com>

Moving net kit libnet.so and libnetapi.so source code to /current.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@895 a95241bf-73f2-0310-859d-f6bbb57e9c96