• R/O
  • SSH
  • HTTPS

tidesnet: Commit


Commit MetaInfo

Revision86 (tree)
Time2020-05-05 01:56:28
Authorquiret

Log Message

- fixes

Change Summary

Incremental Difference

--- library/src/mbedtls.cpp (revision 85)
+++ library/src/mbedtls.cpp (revision 86)
@@ -71,7 +71,7 @@
7171
7272 if ( socket->IsClosed() )
7373 {
74- return -1;
74+ return MBEDTLS_ERR_SSL_CONN_EOF;
7575 }
7676
7777 size_t actualWritten = socket->WriteInternal( buf, actual_send );
@@ -87,11 +87,16 @@
8787
8888 if ( socket->IsClosed() )
8989 {
90- return -1;
90+ return MBEDTLS_ERR_SSL_CONN_EOF;
9191 }
9292
9393 size_t actualRead = socket->ReadInternal( buf, actual_recv, eReceiveFlag::RECEIVE_NONE );
9494
95+ if ( actualRead == 0 )
96+ {
97+ return MBEDTLS_ERR_SSL_CONN_EOF;
98+ }
99+
95100 return (int)actualRead;
96101 }
97102 };
--- library/src/netsocket.cpp (revision 85)
+++ library/src/netsocket.cpp (revision 86)
@@ -792,7 +792,7 @@
792792 linger info;
793793 info.l_onoff = 1;
794794 info.l_linger = linger_time;
795- setsockopt( transportSocket, SOL_SOCKET, SO_LINGER, (const void*)&info, sizeof(info) );
795+ setsockopt( socketFD, SOL_SOCKET, SO_LINGER, (const void*)&info, sizeof(info) );
796796 }
797797
798798 #endif //CROSS PLATFORM CODE
@@ -830,7 +830,7 @@
830830 if ( !nativeSocket->isClosed )
831831 {
832832 int socketFD = nativeSocket->socketFD;
833-
833+
834834 set_socket_linger( socketFD, SAFE_LINGER_PERIOD );
835835
836836 shutdown( socketFD, SHUT_RDWR );
@@ -1039,31 +1039,31 @@
10391039 if ( acceptedFD < 0 )
10401040 {
10411041 // Check for some really nasty errors.
1042- int errno = errno;
1042+ int errcode = errno;
10431043
1044- if ( errno == EBADF || errno == EFAULT || errno == EINVAL || errno == ENOTSOCK )
1044+ if ( errcode == EBADF || errcode == EFAULT || errcode == EINVAL || errcode == ENOTSOCK )
10451045 {
1046- throw TidesException( eNetExceptCode::INTERNAL_ERROR, _linux_get_accept_errormsg( errno ) );
1046+ throw TidesException( eNetExceptCode::INTERNAL_ERROR, _linux_get_accept_errormsg( errcode ) );
10471047 }
10481048
1049- if ( errno == EPROTO )
1049+ if ( errcode == EPROTO )
10501050 {
1051- throw TidesException( eNetExceptCode::PROTOCOL_ERROR, _linux_get_accept_errormsg( errno ) );
1051+ throw TidesException( eNetExceptCode::PROTOCOL_ERROR, _linux_get_accept_errormsg( errcode ) );
10521052 }
10531053
1054- if ( errno == ENFILE || errno == EMFILE )
1054+ if ( errcode == ENFILE || errcode == EMFILE )
10551055 {
1056- throw TidesException( eNetExceptCode::TOO_MANY_HANDLES, _linux_get_accept_errormsg( errno ) );
1056+ throw TidesException( eNetExceptCode::TOO_MANY_HANDLES, _linux_get_accept_errormsg( errcode ) );
10571057 }
10581058
10591059 // If somebody closed the connection even before we could serve them we just try the next guy.
1060- if ( errno == ECONNABORTED )
1060+ if ( errcode == ECONNABORTED )
10611061 {
10621062 // Changed to root-out any possible spin-locks.
1063- throw TidesException( eNetExceptCode::PROTOCOL_ERROR, _linux_get_accept_errormsg( errno ) );
1063+ throw TidesException( eNetExceptCode::PROTOCOL_ERROR, _linux_get_accept_errormsg( errcode ) );
10641064 }
10651065
1066- if ( errno == ENOBUFS || errno == ENOMEM || errno == EINTR )
1066+ if ( errcode == ENOBUFS || errcode == ENOMEM || errcode == EINTR )
10671067 {
10681068 // Allow the runtime to spin a little while.
10691069 // That is the reason why a nullptr is not a bad fault.
@@ -1070,7 +1070,7 @@
10701070 return nullptr;
10711071 }
10721072
1073- throw TidesException( eNetExceptCode::UNKNOWN_ERROR, _linux_get_accept_errormsg( errno ) );
1073+ throw TidesException( eNetExceptCode::UNKNOWN_ERROR, _linux_get_accept_errormsg( errcode ) );
10741074 }
10751075 #else
10761076 #error Missing ConnReceiver::Accept implementation
--- library/src/netsocket.impl.hxx (revision 85)
+++ library/src/netsocket.impl.hxx (revision 86)
@@ -410,9 +410,9 @@
410410 int socketFD;
411411 };
412412
413-inline bool _connReceiver_setupSocket( int socketFD )
413+inline bool _connReceiver_setupSocket( int socketFD, int queue_length )
414414 {
415- int backlogConfigError = listen( socketFD, SOMAXCONN );
415+ int backlogConfigError = listen( socketFD, queue_length );
416416
417417 if ( backlogConfigError != 0 )
418418 {
Show on old repository browser