From 6bdd9395318f55e2ed2377f5770b0ca9fefe1fe5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 17 Dec 2013 19:54:25 -0800 Subject: [PATCH] rename field --- xwords4/linux/cursesmain.c | 4 ++-- xwords4/linux/gtkboard.c | 8 ++++---- xwords4/linux/linuxmain.c | 22 +++++++++++----------- xwords4/linux/main.h | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index 908491571..d4b2613d0 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1131,7 +1131,7 @@ curses_socket_changed( void* closure, int oldSock, int newSock, } #ifdef XWFEATURE_RELAY - globals->cGlobals.socket = newSock; + globals->cGlobals.relaySocket = newSock; #endif } /* curses_socket_changed */ @@ -1938,7 +1938,7 @@ cursesmain( XP_Bool isServer, LaunchParams* params ) g_globals.amServer = isServer; g_globals.cGlobals.params = params; #ifdef XWFEATURE_RELAY - g_globals.cGlobals.socket = -1; + g_globals.cGlobals.relaySocket = -1; #endif g_globals.cGlobals.socketChanged = curses_socket_changed; diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index a4872dfcd..92177d76d 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -2284,7 +2284,7 @@ newConnectionInput( GIOChannel *source, switch ( comms_getConType( globals->cGlobals.game.comms ) ) { #ifdef XWFEATURE_RELAY case COMMS_CONN_RELAY: - XP_ASSERT( globals->cGlobals.socket == sock ); + XP_ASSERT( globals->cGlobals.relaySocket == sock ); nRead = linux_relay_receive( &globals->cGlobals, buf, sizeof(buf) ); break; #endif @@ -2351,7 +2351,7 @@ newConnectionInput( GIOChannel *source, XP_LOGF( "dropping socket %d", sock ); close( sock ); #ifdef XWFEATURE_RELAY - globals->cGlobals.socket = -1; + globals->cGlobals.relaySocket = -1; #endif if ( 0 ) { #ifdef XWFEATURE_BLUETOOTH @@ -2406,7 +2406,7 @@ gtk_socket_changed( void* closure, int oldSock, int newSock, void** storage ) XP_LOGF( "g_io_add_watch(%d) => %d", newSock, result ); } #ifdef XWFEATURE_RELAY - globals->cGlobals.socket = newSock; + globals->cGlobals.relaySocket = newSock; #endif /* A hack for the bluetooth case. */ CommsCtxt* comms = globals->cGlobals.game.comms; @@ -2521,7 +2521,7 @@ initGlobalsNoDraw( GtkGameGlobals* globals, LaunchParams* params, globals->cGlobals.lastNTilesToUse = MAX_TRAY_TILES; #ifndef XWFEATURE_STANDALONE_ONLY # ifdef XWFEATURE_RELAY - globals->cGlobals.socket = -1; + globals->cGlobals.relaySocket = -1; # endif globals->cGlobals.socketChanged = gtk_socket_changed; diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index b699224e2..65bacb12e 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -920,7 +920,7 @@ linux_init_relay_socket( CommonGlobals* cGlobals, const CommsAddrRec* addrRec ) { struct sockaddr_in to_sock; struct hostent* host; - int sock = cGlobals->socket; + int sock = cGlobals->relaySocket; if ( sock == -1 ) { /* make a local copy of the address to send to */ @@ -945,7 +945,7 @@ linux_init_relay_socket( CommonGlobals* cGlobals, const CommsAddrRec* addrRec ) errno = 0; if ( 0 == connect( sock, (const struct sockaddr*)&to_sock, sizeof(to_sock) ) ) { - cGlobals->socket = sock; + cGlobals->relaySocket = sock; XP_LOGF( "%s: connected new socket %d to relay", __func__, sock ); struct timeval tv = {0}; @@ -979,14 +979,14 @@ free_elem_proc( gpointer data ) static bool send_or_close( CommonGlobals* cGlobals, const XP_U8* buf, size_t len ) { - size_t nSent = send( cGlobals->socket, buf, len, 0 ); + size_t nSent = send( cGlobals->relaySocket, buf, len, 0 ); bool success = len == nSent; if ( !success ) { - close( cGlobals->socket ); + close( cGlobals->relaySocket ); (*cGlobals->socketChanged)( cGlobals->socketChangedClosure, - cGlobals->socket, -1, + cGlobals->relaySocket, -1, &cGlobals->storage ); - cGlobals->socket = -1; + cGlobals->relaySocket = -1; /* delete all pending packets since the socket's bad */ for ( GSList* iter = cGlobals->packetQueue; !!iter; iter = iter->next ) { @@ -1067,13 +1067,13 @@ linux_tcp_send( CommonGlobals* cGlobals, const XP_U8* buf, XP_U16 buflen, result = relaycon_send( cGlobals->params, buf, buflen, clientToken, addrRec ); } else { - int sock = cGlobals->socket; + int sock = cGlobals->relaySocket; if ( sock == -1 ) { XP_LOGF( "%s: socket uninitialized", __func__ ); sock = linux_init_relay_socket( cGlobals, addrRec ); if ( sock != -1 ) { - assert( cGlobals->socket == sock ); + assert( cGlobals->relaySocket == sock ); (*cGlobals->socketChanged)( cGlobals->socketChangedClosure, -1, sock, &cGlobals->storage ); } @@ -1194,12 +1194,12 @@ void linux_close_socket( CommonGlobals* cGlobals ) { LOG_FUNC(); - int socket = cGlobals->socket; + int socket = cGlobals->relaySocket; (*cGlobals->socketChanged)( cGlobals->socketChangedClosure, socket, -1, &cGlobals->storage ); - XP_ASSERT( -1 == cGlobals->socket ); + XP_ASSERT( -1 == cGlobals->relaySocket ); close( socket ); } @@ -1241,7 +1241,7 @@ int linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize ) { LOG_FUNC(); - int sock = cGlobals->socket; + int sock = cGlobals->relaySocket; ssize_t nRead = -1; if ( 0 <= sock ) { unsigned short tmp; diff --git a/xwords4/linux/main.h b/xwords4/linux/main.h index 737fde606..336b5cbc6 100644 --- a/xwords4/linux/main.h +++ b/xwords4/linux/main.h @@ -214,7 +214,7 @@ struct CommonGlobals { GHashTable* noConnMsgs; #ifdef XWFEATURE_RELAY - int socket; /* relay */ + int relaySocket; /* tcp connection to relay */ void* storage; char* defaultServerName; #endif