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