mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
fix failure to record bytes forwarded
This commit is contained in:
parent
da323ede86
commit
3cd8397085
3 changed files with 9 additions and 8 deletions
|
@ -402,12 +402,14 @@ CookieRef::handleEvents()
|
|||
}
|
||||
} /* handleEvents */
|
||||
|
||||
static void
|
||||
send_with_length( int socket, unsigned char* buf, int bufLen )
|
||||
void
|
||||
CookieRef::send_with_length( int socket, unsigned char* buf, int bufLen )
|
||||
{
|
||||
SocketWriteLock slock( socket );
|
||||
|
||||
if ( !send_with_length_unsafe( socket, buf, bufLen ) ) {
|
||||
if ( send_with_length_unsafe( socket, buf, bufLen ) ) {
|
||||
RecordSent( bufLen, socket );
|
||||
} else {
|
||||
/* ok that the slock above is still in scope */
|
||||
killSocket( socket, "couldn't send" );
|
||||
}
|
||||
|
@ -466,7 +468,6 @@ CookieRef::sendResponse( const CRefEvent* evt )
|
|||
putNetLong( &bufp, GetCookieID() );
|
||||
|
||||
send_with_length( socket, buf, sizeof(buf) );
|
||||
RecordSent( sizeof(buf), socket );
|
||||
logf( "sent XWRELAY_CONNECTRESP" );
|
||||
} /* sendResponse */
|
||||
|
||||
|
|
|
@ -123,8 +123,8 @@ class CookieRef {
|
|||
|
||||
int SocketForHost( HostID dest );
|
||||
|
||||
void send_with_length( int socket, unsigned char* buf, int bufLen );
|
||||
void RecordSent( int nBytes, int socket ) {
|
||||
/* This really needs a lock.... */
|
||||
m_totalSent += nBytes;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,6 @@ class CookieRef {
|
|||
void pushCanLockEvent( const CRefEvent* evt );
|
||||
void pushCantLockEvent( const CRefEvent* evt );
|
||||
|
||||
|
||||
void handleEvents();
|
||||
|
||||
void sendResponse( const CRefEvent* evt );
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "crefmgr.h"
|
||||
#include "cref.h"
|
||||
#include "mlock.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class SocketStuff {
|
||||
public:
|
||||
SocketStuff( CookieRef* cref )
|
||||
|
|
Loading…
Add table
Reference in a new issue