diff options
author | alonso <alonso@us.es> | 2013-04-26 12:01:22 +0000 |
---|---|---|
committer | alonso <alonso@us.es> | 2013-04-26 12:01:22 +0000 |
commit | 6bbafab93d72a42568b78344cdb12b0217a26529 (patch) | |
tree | e7ba2a5fa339811699e4d7ca91947d4cb3a6b922 /sources | |
parent | 97c3ac85f0a97cc30956d4406f6fbd893185646f (diff) |
git-svn-id: https://opengnsys.es/svn/branches/version1.0@3767 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'sources')
-rw-r--r-- | sources/ogAdmServer.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index a7a3fad..b651c54 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -50,7 +50,6 @@ BOOLEAN tomaConfiguracion(char* filecfg) { fclose(fcfg); servidoradm[0] = (char) NULL; //inicializar variables globales - puerto[0] = (char) NULL; usuario[0] = (char) NULL; pasguor[0] = (char) NULL; datasource[0] = (char) NULL; @@ -1187,8 +1186,10 @@ BOOLEAN buscaComandos(char *ido, TRAMA *ptrTrama, int *ids) BOOLEAN DisponibilidadComandos(SOCKET *socket_c, TRAMA *ptrTrama) { char *iph, *tpc; - int idx; + int idx,port_old=0,port_new; char modulo[] = "DisponibilidadComandos()"; + + iph = copiaParametro("iph",ptrTrama); // Toma ip if (!clienteExistente(iph, &idx)) { // Busca índice del cliente @@ -1198,8 +1199,16 @@ BOOLEAN DisponibilidadComandos(SOCKET *socket_c, TRAMA *ptrTrama) } tpc = copiaParametro("tpc",ptrTrama); // Tipo de cliente (Plataforma y S.O.) strcpy(tbsockets[idx].estado, tpc); - if(tbsockets[idx].sock!=INVALID_SOCKET) - close(tbsockets[idx].sock); // Cierra el socket si ya existia uno + + port_new=tomaPuerto(*socket_c); + + if(tbsockets[idx].sock!=INVALID_SOCKET){ + port_old=tomaPuerto(tbsockets[idx].sock); + if(port_old!=port_new){ + close(tbsockets[idx].sock); // Cierra el socket si ya existia uno + } + } + tbsockets[idx].sock = *socket_c; swcSocket = TRUE; // El socket permanece abierto para recibir comandos desde el servidor liberaMemoria(iph); |