mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
rename field
This commit is contained in:
parent
8d20c33b76
commit
6bdd939531
4 changed files with 18 additions and 18 deletions
|
@ -1131,7 +1131,7 @@ curses_socket_changed( void* closure, int oldSock, int newSock,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
globals->cGlobals.socket = newSock;
|
globals->cGlobals.relaySocket = newSock;
|
||||||
#endif
|
#endif
|
||||||
} /* curses_socket_changed */
|
} /* curses_socket_changed */
|
||||||
|
|
||||||
|
@ -1938,7 +1938,7 @@ cursesmain( XP_Bool isServer, LaunchParams* params )
|
||||||
g_globals.amServer = isServer;
|
g_globals.amServer = isServer;
|
||||||
g_globals.cGlobals.params = params;
|
g_globals.cGlobals.params = params;
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
g_globals.cGlobals.socket = -1;
|
g_globals.cGlobals.relaySocket = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_globals.cGlobals.socketChanged = curses_socket_changed;
|
g_globals.cGlobals.socketChanged = curses_socket_changed;
|
||||||
|
|
|
@ -2284,7 +2284,7 @@ newConnectionInput( GIOChannel *source,
|
||||||
switch ( comms_getConType( globals->cGlobals.game.comms ) ) {
|
switch ( comms_getConType( globals->cGlobals.game.comms ) ) {
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
case COMMS_CONN_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) );
|
nRead = linux_relay_receive( &globals->cGlobals, buf, sizeof(buf) );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2351,7 +2351,7 @@ newConnectionInput( GIOChannel *source,
|
||||||
XP_LOGF( "dropping socket %d", sock );
|
XP_LOGF( "dropping socket %d", sock );
|
||||||
close( sock );
|
close( sock );
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
globals->cGlobals.socket = -1;
|
globals->cGlobals.relaySocket = -1;
|
||||||
#endif
|
#endif
|
||||||
if ( 0 ) {
|
if ( 0 ) {
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#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 );
|
XP_LOGF( "g_io_add_watch(%d) => %d", newSock, result );
|
||||||
}
|
}
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
globals->cGlobals.socket = newSock;
|
globals->cGlobals.relaySocket = newSock;
|
||||||
#endif
|
#endif
|
||||||
/* A hack for the bluetooth case. */
|
/* A hack for the bluetooth case. */
|
||||||
CommsCtxt* comms = globals->cGlobals.game.comms;
|
CommsCtxt* comms = globals->cGlobals.game.comms;
|
||||||
|
@ -2521,7 +2521,7 @@ initGlobalsNoDraw( GtkGameGlobals* globals, LaunchParams* params,
|
||||||
globals->cGlobals.lastNTilesToUse = MAX_TRAY_TILES;
|
globals->cGlobals.lastNTilesToUse = MAX_TRAY_TILES;
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
# ifdef XWFEATURE_RELAY
|
# ifdef XWFEATURE_RELAY
|
||||||
globals->cGlobals.socket = -1;
|
globals->cGlobals.relaySocket = -1;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
globals->cGlobals.socketChanged = gtk_socket_changed;
|
globals->cGlobals.socketChanged = gtk_socket_changed;
|
||||||
|
|
|
@ -920,7 +920,7 @@ linux_init_relay_socket( CommonGlobals* cGlobals, const CommsAddrRec* addrRec )
|
||||||
{
|
{
|
||||||
struct sockaddr_in to_sock;
|
struct sockaddr_in to_sock;
|
||||||
struct hostent* host;
|
struct hostent* host;
|
||||||
int sock = cGlobals->socket;
|
int sock = cGlobals->relaySocket;
|
||||||
if ( sock == -1 ) {
|
if ( sock == -1 ) {
|
||||||
|
|
||||||
/* make a local copy of the address to send to */
|
/* 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;
|
errno = 0;
|
||||||
if ( 0 == connect( sock, (const struct sockaddr*)&to_sock,
|
if ( 0 == connect( sock, (const struct sockaddr*)&to_sock,
|
||||||
sizeof(to_sock) ) ) {
|
sizeof(to_sock) ) ) {
|
||||||
cGlobals->socket = sock;
|
cGlobals->relaySocket = sock;
|
||||||
XP_LOGF( "%s: connected new socket %d to relay", __func__, sock );
|
XP_LOGF( "%s: connected new socket %d to relay", __func__, sock );
|
||||||
|
|
||||||
struct timeval tv = {0};
|
struct timeval tv = {0};
|
||||||
|
@ -979,14 +979,14 @@ free_elem_proc( gpointer data )
|
||||||
static bool
|
static bool
|
||||||
send_or_close( CommonGlobals* cGlobals, const XP_U8* buf, size_t len )
|
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;
|
bool success = len == nSent;
|
||||||
if ( !success ) {
|
if ( !success ) {
|
||||||
close( cGlobals->socket );
|
close( cGlobals->relaySocket );
|
||||||
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
||||||
cGlobals->socket, -1,
|
cGlobals->relaySocket, -1,
|
||||||
&cGlobals->storage );
|
&cGlobals->storage );
|
||||||
cGlobals->socket = -1;
|
cGlobals->relaySocket = -1;
|
||||||
|
|
||||||
/* delete all pending packets since the socket's bad */
|
/* delete all pending packets since the socket's bad */
|
||||||
for ( GSList* iter = cGlobals->packetQueue; !!iter; iter = iter->next ) {
|
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,
|
result = relaycon_send( cGlobals->params, buf, buflen,
|
||||||
clientToken, addrRec );
|
clientToken, addrRec );
|
||||||
} else {
|
} else {
|
||||||
int sock = cGlobals->socket;
|
int sock = cGlobals->relaySocket;
|
||||||
|
|
||||||
if ( sock == -1 ) {
|
if ( sock == -1 ) {
|
||||||
XP_LOGF( "%s: socket uninitialized", __func__ );
|
XP_LOGF( "%s: socket uninitialized", __func__ );
|
||||||
sock = linux_init_relay_socket( cGlobals, addrRec );
|
sock = linux_init_relay_socket( cGlobals, addrRec );
|
||||||
if ( sock != -1 ) {
|
if ( sock != -1 ) {
|
||||||
assert( cGlobals->socket == sock );
|
assert( cGlobals->relaySocket == sock );
|
||||||
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
||||||
-1, sock, &cGlobals->storage );
|
-1, sock, &cGlobals->storage );
|
||||||
}
|
}
|
||||||
|
@ -1194,12 +1194,12 @@ void
|
||||||
linux_close_socket( CommonGlobals* cGlobals )
|
linux_close_socket( CommonGlobals* cGlobals )
|
||||||
{
|
{
|
||||||
LOG_FUNC();
|
LOG_FUNC();
|
||||||
int socket = cGlobals->socket;
|
int socket = cGlobals->relaySocket;
|
||||||
|
|
||||||
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
(*cGlobals->socketChanged)( cGlobals->socketChangedClosure,
|
||||||
socket, -1, &cGlobals->storage );
|
socket, -1, &cGlobals->storage );
|
||||||
|
|
||||||
XP_ASSERT( -1 == cGlobals->socket );
|
XP_ASSERT( -1 == cGlobals->relaySocket );
|
||||||
|
|
||||||
close( socket );
|
close( socket );
|
||||||
}
|
}
|
||||||
|
@ -1241,7 +1241,7 @@ int
|
||||||
linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize )
|
linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize )
|
||||||
{
|
{
|
||||||
LOG_FUNC();
|
LOG_FUNC();
|
||||||
int sock = cGlobals->socket;
|
int sock = cGlobals->relaySocket;
|
||||||
ssize_t nRead = -1;
|
ssize_t nRead = -1;
|
||||||
if ( 0 <= sock ) {
|
if ( 0 <= sock ) {
|
||||||
unsigned short tmp;
|
unsigned short tmp;
|
||||||
|
|
|
@ -214,7 +214,7 @@ struct CommonGlobals {
|
||||||
GHashTable* noConnMsgs;
|
GHashTable* noConnMsgs;
|
||||||
|
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
int socket; /* relay */
|
int relaySocket; /* tcp connection to relay */
|
||||||
void* storage;
|
void* storage;
|
||||||
char* defaultServerName;
|
char* defaultServerName;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue