summaryrefslogtreecommitdiff
path: root/osdep
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2018-01-26 20:00:37 -0500
committerAdam Ierymenko <adam.ierymenko@gmail.com>2018-01-26 20:00:37 -0500
commitf3dfd636343904a01681c80e91b44aa00ce33f2e (patch)
tree12ab5514aaffaba0759bef88fa3b2c8a34bad565 /osdep
parent5f5302e59535c988188e3857469c5414014d62c4 (diff)
downloadinfinitytier-f3dfd636343904a01681c80e91b44aa00ce33f2e.tar.gz
infinitytier-f3dfd636343904a01681c80e91b44aa00ce33f2e.zip
Clean up some old stuff.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/Phy.hpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/osdep/Phy.hpp b/osdep/Phy.hpp
index 8e683f10..243db0a8 100644
--- a/osdep/Phy.hpp
+++ b/osdep/Phy.hpp
@@ -688,25 +688,26 @@ public:
* until one works.
*
* @param sock Socket
- * @param bufferSize Desired buffer sizes
+ * @param receiveBufferSize Desired size of receive buffer
+ * @param sendBufferSize Desired size of send buffer
*/
- inline void setBufferSizes(const PhySocket *sock,int bufferSize)
+ inline void setBufferSizes(const PhySocket *sock,int receiveBufferSize,int sendBufferSize)
{
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
- if (bufferSize > 0) {
- int bs = bufferSize;
- while (bs >= 65536) {
- int tmpbs = bs;
+ if (receiveBufferSize > 0) {
+ while (receiveBufferSize > 0) {
+ int tmpbs = receiveBufferSize;
if (::setsockopt(sws.sock,SOL_SOCKET,SO_RCVBUF,(const char *)&tmpbs,sizeof(tmpbs)) == 0)
break;
- bs -= 16384;
+ receiveBufferSize -= 16384;
}
- bs = bufferSize;
- while (bs >= 65536) {
- int tmpbs = bs;
+ }
+ if (sendBufferSize > 0) {
+ while (sendBufferSize > 0) {
+ int tmpbs = sendBufferSize;
if (::setsockopt(sws.sock,SOL_SOCKET,SO_SNDBUF,(const char *)&tmpbs,sizeof(tmpbs)) == 0)
break;
- bs -= 16384;
+ sendBufferSize -= 16384;
}
}
}