#include "rcs_defs.hh"
#include "sokintrf.h"
#include "linklist.hh"
#include "rcs_prnt.hh"
#include "tcp_opts.hh"
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "recvn.h"
#include "sendn.h"
Include dependency graph for tcpproxy.cc:
Go to the source code of this file.
Data Structures | |
class | TCP_PROXY_ENTRY |
Functions | |
int RCS_EXPORT | recvn (int fd, void *vptr, int n, int flags, double timeout, int *bytes_read_ptr) |
int RCS_EXPORT | sendn (int fd, const void *vptr, int n, int flags, double timeout) |
void | handle_pipe_error (int id) |
void | handle_sigint (int id) |
int | main (int argc, char **argv) |
Variables | |
int | recvn_timedout |
int | print_recvn_timeout_errors |
int | last_pipe_error_id = 0 |
int | tcpproxy_quit = 0 |
int | last_sigint_id = 0 |
hostent * | server_host_entry |
|
Definition at line 40 of file recvn.c. Referenced by TCPMEM::blocking_read(), TCPMEM::check_if_read(), TCPMEM::clear(), TCPMEM::get_diagnostics_info(), TCPMEM::handle_old_replies(), TCPMEM::login(), TCPMEM::peek(), TCPMEM::read(), TCPMEM::reconnect(), TCPMEM::verify_bufname(), TCPMEM::write(), and TCPMEM::write_if_read().
00042 { 00043 int nleft, nrecv; 00044 int select_ret; 00045 char *ptr; 00046 double start_time, current_time; 00047 struct timeval timeout_tv; 00048 fd_set recv_fd_set; 00049 int bytes_ready; 00050 int bytes_to_read; 00051 if (etime_disabled) 00052 { 00053 _timeout = -1.0; 00054 } 00055 00056 bytes_ready = bytes_to_read = 0; 00057 timeout_tv.tv_sec = (long) _timeout; 00058 timeout_tv.tv_usec = (long) (_timeout * 1000000.0); 00059 if (timeout_tv.tv_usec >= 1000000) 00060 { 00061 timeout_tv.tv_usec = timeout_tv.tv_usec % 1000000; 00062 } 00063 FD_ZERO (&recv_fd_set); 00064 RCS_FD_SET (fd, &recv_fd_set); 00065 00066 recvn_timedout = 0; 00067 ptr = (char *) vptr; 00068 nleft = n; 00069 if (NULL != bytes_read_ptr) 00070 { 00071 if (*bytes_read_ptr >= n) 00072 { 00073 rcs_print_error 00074 ("recvn: Invalid parameter -- (*bytes_read_ptr = %d) must be less than (n = %d).\n", 00075 *bytes_read_ptr, n); 00076 return -1; 00077 } 00078 if (*bytes_read_ptr < 0) 00079 { 00080 rcs_print_error 00081 ("recvn: Invalid parameter -- (*bytes_read_ptr = %d) must be greater than or equal to zero.\n"); 00082 return -1; 00083 } 00084 ptr += *bytes_read_ptr; 00085 nleft -= *bytes_read_ptr; 00086 } 00087 00088 start_time = etime (); 00089 while (nleft > 0) 00090 { 00091 if (_timeout > 0.0) 00092 { 00093 switch (select_ret = 00094 dl_select (fd + 1, &recv_fd_set, (fd_set *) NULL, 00095 (fd_set *) NULL, &timeout_tv)) 00096 { 00097 case -1: 00098 #if !defined(_Windows) || defined(gnuwin32) 00099 rcs_print_error ("Error in select: %d -> %s\n", errno, 00100 strerror (errno)); 00101 #else 00102 rcs_print_error ("Error in select: %d\n", 00103 dl_WSAGetLastError ()); 00104 #endif 00105 if (NULL == bytes_read_ptr) 00106 { 00107 rcs_print_error 00108 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f) failed.\n", 00109 fd, vptr, n, flags, _timeout); 00110 } 00111 else 00112 { 00113 rcs_print_error 00114 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f,bytes_read=%d) failed.\n", 00115 fd, vptr, n, flags, _timeout, *bytes_read_ptr); 00116 } 00117 return -1; 00118 00119 case 0: 00120 if (print_recvn_timeout_errors) 00121 { 00122 rcs_print_error ("Recv timed out.\n"); 00123 if (NULL == bytes_read_ptr) 00124 { 00125 rcs_print_error 00126 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f) failed.\n", 00127 fd, vptr, n, flags, _timeout); 00128 } 00129 else 00130 { 00131 rcs_print_error 00132 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f,bytes_read=%d) failed.\n", 00133 fd, vptr, n, flags, _timeout, *bytes_read_ptr); 00134 } 00135 } 00136 recvn_timedout = 1; 00137 if (NULL != bytes_read_ptr) 00138 { 00139 *bytes_read_ptr = (n - nleft); 00140 } 00141 return -1; 00142 00143 default: 00144 break; 00145 } 00146 bytes_ready = 0; 00147 #if defined(WIN32) && !defined(gnuwin32) 00148 dl_ioctlsocket (fd, FIONREAD, &bytes_ready); 00149 #else 00150 #ifndef VXWORKS 00151 #ifdef MSDOS 00152 bytes_ready = nleft; 00153 #else 00154 ioctl (fd, FIONREAD, (caddr_t) & bytes_ready); 00155 #endif 00156 #else 00157 ioctl (fd, FIONREAD, (int) &bytes_ready); 00158 #endif 00159 #endif 00160 bytes_to_read = (nleft <= bytes_ready) ? nleft : bytes_ready; 00161 } 00162 else 00163 { 00164 bytes_to_read = nleft; 00165 } 00166 nrecv = 0; 00167 if (bytes_to_read > 0) 00168 { 00169 if ((nrecv = dl_recv (fd, ptr, bytes_to_read, flags)) == -1) 00170 { 00171 if ( 00172 #if !defined(_WINDOWS) || defined(gnuwin32) 00173 #ifdef MSDOS 00174 (EWOULDBLOCK == (tk_geterrno (fd))) 00175 #else 00176 (errno == EWOULDBLOCK) 00177 #endif 00178 #else 00179 (WSAEWOULDBLOCK == (dl_WSAGetLastError ())) 00180 #endif 00181 ) 00182 { 00183 if (fabs (_timeout) < 1e-6) 00184 { 00185 recvn_timedout = 1; 00186 if (NULL != bytes_read_ptr) 00187 { 00188 *bytes_read_ptr = (n - nleft); 00189 } 00190 return -1; 00191 } 00192 } 00193 else 00194 { 00195 #ifndef UNDER_CE 00196 #ifdef WIN32 00197 rcs_print_sys_error (WSAGETLASTERROR_ERROR_SOURCE, 00198 "recv error:"); 00199 #else 00200 rcs_print_error ("Recv error: %d = %s\n", errno, 00201 strerror (errno)); 00202 #endif 00203 #endif 00204 if (NULL == bytes_read_ptr) 00205 { 00206 rcs_print_error 00207 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f) failed.\n", 00208 fd, vptr, n, flags, _timeout); 00209 } 00210 else 00211 { 00212 rcs_print_error 00213 ("recvn(fd=%d, vptr=%p, int n=%d, int flags=%d, double _timeout=%f,bytes_read=%d) failed.\n", 00214 fd, vptr, n, flags, _timeout, *bytes_read_ptr); 00215 } 00216 if (NULL != bytes_read_ptr) 00217 { 00218 *bytes_read_ptr = (n - nleft); 00219 } 00220 return (-1); /* error, return < 0 */ 00221 } 00222 nrecv = 0; 00223 } 00224 else if (nrecv == 0) 00225 { 00226 rcs_print_error ("recvn: Premature EOF recieved.\n"); 00227 return (-2); 00228 } 00229 } 00230 nleft -= nrecv; 00231 ptr += nrecv; 00232 if (nleft > 0 && _timeout > 0.0) 00233 { 00234 esleep (0.001); 00235 current_time = etime (); 00236 if (current_time - start_time > _timeout) 00237 { 00238 rcs_print_error ("Recv timed out.\n"); 00239 recvn_timedout = 1; 00240 if (NULL != bytes_read_ptr) 00241 { 00242 *bytes_read_ptr = (n - nleft); 00243 } 00244 return (-1); 00245 } 00246 } 00247 } 00248 rcs_print_debug (PRINT_SOCKET_READ_SIZE, "read %d bytes from %d\n", n, fd); 00249 if (NULL != bytes_read_ptr) 00250 { 00251 *bytes_read_ptr = (n - nleft); 00252 } 00253 return (n - nleft); /* return >= 0 */ 00254 } |
|
Definition at line 32 of file sendn.c. Referenced by TCPMEM::blocking_read(), TCPMEM::check_if_read(), TCPMEM::clear(), TCPMEM::disconnect(), TCPMEM::get_diagnostics_info(), TCPMEM::login(), TCPMEM::peek(), TCPMEM::read(), TCPMEM::reconnect(), TCPMEM::send_diag_info(), sendline(), CMS_SERVER_REMOTE_TCP_PORT::update_subscriptions(), TCPMEM::verify_bufname(), TCPMEM::write(), and TCPMEM::write_if_read().
00033 { 00034 int nleft; 00035 long nwritten; 00036 int select_ret; 00037 double start_time, current_time; 00038 char *ptr; 00039 struct timeval timeout_tv; 00040 fd_set send_fd_set; 00041 00042 timeout_tv.tv_sec = (long) _timeout; 00043 timeout_tv.tv_usec = (long) (_timeout * 1000000.0); 00044 if (timeout_tv.tv_usec >= 1000000) 00045 { 00046 timeout_tv.tv_usec = timeout_tv.tv_usec % 1000000; 00047 } 00048 FD_ZERO (&send_fd_set); 00049 RCS_FD_SET (fd, &send_fd_set); 00050 00051 ptr = (char *) vptr; /* can't do pointer arithmetic on void* */ 00052 nleft = n; 00053 start_time = etime (); 00054 while (nleft > 0) 00055 { 00056 if (fabs (_timeout) > 1E-6) 00057 { 00058 if (_timeout > 0) 00059 { 00060 select_ret = 00061 dl_select (fd + 1, (fd_set *) NULL, &send_fd_set, 00062 (fd_set *) NULL, &timeout_tv); 00063 } 00064 else 00065 { 00066 select_ret = 00067 dl_select (fd + 1, (fd_set *) NULL, &send_fd_set, 00068 (fd_set *) NULL, NULL); 00069 } 00070 switch (select_ret) 00071 { 00072 case -1: 00073 #if !defined(_Windows) || defined(gnuwin32) 00074 rcs_print_error ("Error in select: %d -> %s\n", errno, 00075 strerror (errno)); 00076 #else 00077 rcs_print_error ("Error in select: %d\n", 00078 dl_WSAGetLastError ()); 00079 #endif 00080 rcs_print_error 00081 ("sendn(fd=%d, vptr=%p, int n=%d, int _flags=%d, double _timeout=%f) failed.\n", 00082 fd, vptr, n, _flags, _timeout); 00083 return -1; 00084 00085 case 0: 00086 rcs_print_error ("Write timed out.\n"); 00087 return -1; 00088 00089 default: 00090 break; 00091 } 00092 } 00093 if ((nwritten = dl_send (fd, ptr, nleft, _flags)) == -1) 00094 { 00095 #if!defined(_WINDOWS) || defined(gnuwin32) 00096 rcs_print_error ("Send error: %d = %s\n", errno, strerror (errno)); 00097 #else 00098 rcs_print_error ("Send error: %d\n", dl_WSAGetLastError ()); 00099 #endif 00100 return (-1); /* error */ 00101 } 00102 nleft -= nwritten; 00103 ptr += nwritten; 00104 if (nleft > 0 && _timeout > 0.0) 00105 { 00106 current_time = etime (); 00107 if (current_time - start_time > _timeout) 00108 { 00109 rcs_print_error ("sendn: timed out after %f seconds.\n", 00110 current_time - start_time); 00111 return (-1); 00112 } 00113 esleep (0.001); 00114 } 00115 } 00116 rcs_print_debug (PRINT_SOCKET_WRITE_SIZE, "wrote %d bytes to %d\n", n, fd); 00117 return (n); 00118 } |
|
Definition at line 113 of file tcpproxy.cc. 00114 { 00115 rcs_print_error ("Can't load socket interface.\n"); 00116 exit (-1); 00117 } |
|
Definition at line 123 of file tcpproxy.cc. 00126 { 00127 rcs_print_error ("Couldn't get host address for (%s).\n", remote_host); |
|
Definition at line 144 of file tcpproxy.cc. 00144 : Couldn't get host address for (%s).\n", 00145 remote_host); 00146 exit (-1); 00147 } 00148 #endif 00149 server_socket_address.sin_port = dl_htons ((unsigned short) remote_port); 00150 00151 memset (&proxy_socket_address, 0, sizeof (proxy_socket_address)); 00152 proxy_socket_address.sin_family = AF_INET; 00153 proxy_socket_address.sin_addr.s_addr = dl_htonl (INADDR_ANY); 00154 proxy_socket_address.sin_port = dl_htons (local_port); 00155 00156 rcs_print_debug (PRINT_CMS_CONFIG_INFO, 00157 "Registering server on TCP port %d.\n", 00158 dl_ntohs (proxy_socket_address.sin_port)); 00159 if (proxy_socket_address.sin_port == 0) 00160 { 00161 rcs_print_error ("server can not register on port number 0.\n"); 00162 exit (-1); 00163 } 00164 SOCKET connection_socket; 00165 00166 if ((long) (connection_socket = dl_socket (AF_INET, SOCK_STREAM, 0)) <= 0) 00167 { 00168 rcs_print_error ("socket error: %d -- %s\n", errno, strerror (errno)); 00169 rcs_print_error ("Server can not open stream socket.\n"); 00170 exit (-1); 00171 } 00172 00173 if (set_tcp_socket_options (connection_socket) < 0) 00174 { 00175 exit (-1); 00176 } 00177 if (dl_bind (connection_socket, (struct sockaddr *) &proxy_socket_address, 00178 sizeof (proxy_socket_address)) < 0) 00179 { 00180 rcs_print_error ("bind error: %d -- %s\n", errno, strerror (errno)); 00181 rcs_print_error 00182 ("Server can not bind the connection socket on port %d.\n", 00183 dl_ntohs (proxy_socket_address.sin_port)); 00184 exit (-1); 00185 } 00186 if (dl_listen (connection_socket, 5) < 0) 00187 { 00188 rcs_print_error ("listen error: %d -- %s\n", errno, strerror (errno)); 00189 rcs_print_error ("TCP Server: error on call to listen for port %d.\n", 00190 dl_ntohs (server_socket_address.sin_port)); 00191 exit (-1); 00192 } 00193 00194 unsigned long bytes_ready; 00195 int ready_descriptors; 00196 fd_set read_fd_set, write_fd_set; 00197 FD_ZERO (&read_fd_set); 00198 FD_ZERO (&write_fd_set); 00199 RCS_FD_SET (connection_socket, &read_fd_set); 00200 SOCKET maxfdpl; 00201 maxfdpl = connection_socket + 1; 00202 TCP_PROXY_ENTRY *current_entry; 00203 00204 #ifndef DOS_WINDOWS 00205 signal (SIGPIPE, handle_pipe_error); 00206 #endif 00207 signal (SIGINT, handle_sigint); 00208 rcs_print 00209 ("Running TCP proxy for:\n (TCP port %d) \n(connection_socket = %d)\n(remote_host = %s)\n(server_IP_address = %s)\n(remote_port = %d)", 00210 dl_ntohs (proxy_socket_address.sin_port), connection_socket, remote_host, 00211 dl_inet_ntoa (server_socket_address.sin_addr), remote_port); 00212 00213 char temp_buffer[4096]; 00214 00215 while (!tcpproxy_quit) 00216 { 00217 ready_descriptors = 00218 dl_select (maxfdpl, 00219 &read_fd_set, 00220 &write_fd_set, (fd_set *) NULL, (timeval *) NULL); 00221 if (ready_descriptors < 0) 00222 { 00223 rcs_print_error 00224 ("select(%d,%d,%d,NULL,NULL) error.(errno = %d | %s)\n", maxfdpl, 00225 read_fd_set, write_fd_set, errno, strerror (errno)); 00226 continue; 00227 } 00228 current_entry = (TCP_PROXY_ENTRY *) proxy_sockets->get_head (); 00229 while (NULL != current_entry) 00230 { 00231 if (dl_fd_isset (current_entry->client_socket, &read_fd_set)) 00232 { 00233 ready_descriptors--; 00234 dl_ioctlsocket (current_entry->client_socket, FIONREAD, 00235 &bytes_ready); 00236 if (bytes_ready == 0) 00237 { 00238 rcs_print ("Socket closed by host with IP address %s.\n", 00239 dl_inet_ntoa (current_entry->client_address. 00240 sin_addr)); 00241 dl_closesocket (current_entry->server_socket); 00242 dl_closesocket (current_entry->client_socket); 00243 if (dl_fd_isset 00244 (current_entry->server_socket, &read_fd_set)) 00245 { 00246 RCS_FD_CLR (current_entry->server_socket, &read_fd_set); 00247 } 00248 if (dl_fd_isset 00249 (current_entry->client_socket, &read_fd_set)) 00250 { 00251 RCS_FD_CLR (current_entry->client_socket, &read_fd_set); 00252 } 00253 proxy_sockets->delete_current_node (); 00254 current_entry = 00255 (TCP_PROXY_ENTRY *) proxy_sockets->get_next (); 00256 continue; 00257 } 00258 else 00259 { 00260 while (bytes_ready > 0) 00261 { 00262 if (bytes_ready > 4096) 00263 { 00264 recvn (current_entry->client_socket, temp_buffer, 00265 4096, 0, -1, NULL); 00266 sendn (current_entry->server_socket, temp_buffer, 00267 4096, 0, -1); 00268 bytes_ready -= 4096; 00269 } 00270 else 00271 { 00272 recvn (current_entry->client_socket, temp_buffer, 00273 bytes_ready, 0, -1, NULL); 00274 sendn (current_entry->server_socket, temp_buffer, 00275 bytes_ready, 0, -1); 00276 bytes_ready = 0; 00277 break; 00278 } 00279 } 00280 } 00281 } 00282 else 00283 { 00284 RCS_FD_SET (current_entry->client_socket, &read_fd_set); 00285 } 00286 if (dl_fd_isset (current_entry->server_socket, &read_fd_set)) 00287 { 00288 ready_descriptors--; 00289 #ifdef WIN32 00290 dl_ioctlsocket (current_entry->server_socket, FIONREAD, 00291 &bytes_ready); 00292 #else 00293 #ifndef VXWORKS 00294 ioctl (current_entry->server_socket, FIONREAD, 00295 (caddr_t) & bytes_ready); 00296 #else 00297 ioctl (current_entry->server_socket, FIONREAD, 00298 (int) &bytes_ready); 00299 #endif 00300 #endif 00301 if (bytes_ready == 0) 00302 { 00303 rcs_print ("Socket closed by host with IP address %s.\n", 00304 dl_inet_ntoa (server_socket_address.sin_addr)); 00305 dl_closesocket (current_entry->server_socket); 00306 dl_closesocket (current_entry->client_socket); 00307 if (dl_fd_isset 00308 (current_entry->server_socket, &read_fd_set)) 00309 { 00310 RCS_FD_CLR (current_entry->server_socket, &read_fd_set); 00311 } 00312 if (dl_fd_isset 00313 (current_entry->client_socket, &read_fd_set)) 00314 { 00315 RCS_FD_CLR (current_entry->client_socket, &read_fd_set); 00316 } 00317 proxy_sockets->delete_current_node (); 00318 current_entry = 00319 (TCP_PROXY_ENTRY *) proxy_sockets->get_next (); 00320 continue; 00321 } 00322 else 00323 { 00324 while (bytes_ready > 0) 00325 { 00326 if (bytes_ready > 4096) 00327 { 00328 recvn (current_entry->server_socket, temp_buffer, 00329 4096, 0, -1, NULL); 00330 sendn (current_entry->client_socket, temp_buffer, 00331 4096, 0, -1); 00332 bytes_ready -= 4096; 00333 } 00334 else 00335 { 00336 recvn (current_entry->server_socket, temp_buffer, 00337 bytes_ready, 0, -1, NULL); 00338 sendn (current_entry->client_socket, temp_buffer, 00339 bytes_ready, 0, -1); 00340 bytes_ready = 0; 00341 break; 00342 } 00343 } 00344 } 00345 } 00346 else 00347 { 00348 RCS_FD_SET (current_entry->server_socket, &read_fd_set); 00349 } 00350 current_entry = (TCP_PROXY_ENTRY *) proxy_sockets->get_next (); 00351 } 00352 if (dl_fd_isset (connection_socket, &read_fd_set) 00353 && ready_descriptors > 0) 00354 { 00355 ready_descriptors--; 00356 current_entry = new TCP_PROXY_ENTRY; 00357 if (NULL == current_entry) 00358 { 00359 continue; 00360 } 00361 current_entry->server_socket = dl_socket (AF_INET, SOCK_STREAM, 0); 00362 if (((long) current_entry->server_socket) <= 0) 00363 { 00364 rcs_print_error ("Error from socket() (errno = %d:%s)\n", 00365 errno, strerror (errno)); 00366 delete current_entry; 00367 continue; 00368 } 00369 proxy_client_socket_address.sin_family = AF_INET; 00370 proxy_client_socket_address.sin_addr.s_addr = dl_htonl (INADDR_ANY); 00371 proxy_client_socket_address.sin_port = dl_htons (0); 00372 00373 if (dl_bind (current_entry->server_socket, 00374 (struct sockaddr *) &proxy_client_socket_address, 00375 sizeof (proxy_client_socket_address)) < 0) 00376 { 00377 #if defined(_Windows) && !defined(USE_PCNFS) 00378 rcs_print_error (" bind error %d\n", dl_WSAGetLastError ()); 00379 #else 00380 rcs_print_error (" bind error %d = %s\n", errno, 00381 strerror (errno)); 00382 #endif 00383 delete current_entry; 00384 continue; 00385 } 00386 if (dl_connect (current_entry->server_socket, 00387 (struct sockaddr *) &server_socket_address, 00388 sizeof (server_socket_address)) < 0) 00389 { 00390 #if defined(_WINDOWS) && !defined(USE_PCNFS) 00391 rcs_print_error ("Couldn't connect. Error = (%d)\n", 00392 dl_WSAGetLastError ()); 00393 #else 00394 rcs_print_error ("Couldn't connect. Error = (%d:%s)\n", 00395 errno, strerror (errno)); 00396 #endif 00397 delete current_entry; 00398 current_entry = NULL; 00399 continue; 00400 } 00401 int client_address_length; 00402 client_address_length = sizeof (current_entry->client_address); 00403 current_entry->client_socket = dl_accept (connection_socket, 00404 (struct sockaddr *) 00405 & 00406 (current_entry-> 00407 client_address), 00408 &client_address_length); 00409 if (((long) current_entry->client_socket) <= 0) 00410 { 00411 #if defined(_WINDOWS) && !defined(USE_PCNFS) 00412 rcs_print_error ("accept error = (%d)\n", 00413 dl_WSAGetLastError ()); 00414 #else 00415 rcs_print_error ("accept error = (%d:%s)\n", 00416 errno, strerror (errno)); 00417 #endif 00418 continue; 00419 } 00420 rcs_print ("Socket opened by host with IP address %s.\n", 00421 dl_inet_ntoa (current_entry->client_address.sin_addr)); 00422 if (NULL != proxy_sockets) 00423 { 00424 proxy_sockets->store_at_tail (current_entry, 00425 sizeof (TCP_PROXY_ENTRY), 0); 00426 } 00427 if (maxfdpl < current_entry->client_socket + 1) 00428 { 00429 maxfdpl = current_entry->client_socket + 1; 00430 } 00431 if (maxfdpl < current_entry->server_socket + 1) 00432 { 00433 maxfdpl = current_entry->server_socket + 1; 00434 } 00435 RCS_FD_SET (current_entry->server_socket, &read_fd_set); 00436 RCS_FD_SET (current_entry->client_socket, &read_fd_set); 00437 } 00438 else 00439 { 00440 RCS_FD_SET (connection_socket, &read_fd_set); 00441 } 00442 if (0 != ready_descriptors) 00443 { 00444 rcs_print_error ("%d descriptors ready but not serviced.\n", 00445 ready_descriptors); 00446 } 00447 } 00448 00449 00450 current_entry = (TCP_PROXY_ENTRY *) proxy_sockets->get_head (); 00451 while (NULL != current_entry) 00452 { 00453 dl_closesocket (current_entry->server_socket); 00454 dl_closesocket (current_entry->client_socket); 00455 current_entry = (TCP_PROXY_ENTRY *) proxy_sockets->get_next (); 00456 } 00457 dl_closesocket (connection_socket); 00458 delete proxy_sockets; 00459 exit (0); 00460 } |
|
Definition at line 55 of file tcpproxy.cc. |
|
Definition at line 56 of file tcpproxy.cc. |
|
Definition at line 110 of file tcpproxy.cc. |
|
Definition at line 119 of file tcpproxy.cc. |
|
Definition at line 120 of file tcpproxy.cc. |
|
Definition at line 130 of file tcpproxy.cc. |