diff options
Diffstat (limited to 'stream/tcp.c')
-rw-r--r-- | stream/tcp.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/stream/tcp.c b/stream/tcp.c index 5dfaa8304f..a3bf264b6e 100644 --- a/stream/tcp.c +++ b/stream/tcp.c @@ -34,7 +34,6 @@ #include "config.h" #include "mp_msg.h" -#include "help_mp.h" #if !HAVE_WINSOCK2_H #include <netdb.h> @@ -133,7 +132,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { case AF_INET6: our_s_addr = (void *) &server_address.six.sin6_addr; break; #endif default: - mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); + mp_tmsg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d\n", af); return TCP_ERROR_FATAL; } @@ -148,7 +147,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { if ( inet_addr(host)==INADDR_NONE ) #endif { - if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ResolvingHostForAF, host, af2String(af)); + if(verb) mp_tmsg(MSGT_NETWORK,MSGL_STATUS,"Resolving %s for %s...\n", host, af2String(af)); #ifdef HAVE_GETHOSTBYNAME2 hp=(struct hostent*)gethostbyname2( host, af ); @@ -156,7 +155,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { hp=(struct hostent*)gethostbyname( host ); #endif if( hp==NULL ) { - if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantResolv, af2String(af), host); + if(verb) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Couldn't resolve name for %s: %s\n", af2String(af), host); return TCP_ERROR_FATAL; } @@ -183,7 +182,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { break; #endif default: - mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af); + mp_tmsg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d\n", af); return TCP_ERROR_FATAL; } @@ -192,7 +191,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { #else inet_ntop(af, our_s_addr, buf, 255); #endif - if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); + if(verb) mp_tmsg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%s]: %d...\n", host, buf , port ); // Turn the socket as non blocking so we can timeout on the connection #if !HAVE_WINSOCK2_H @@ -207,7 +206,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { #endif - if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantConnect2Server, af2String(af)); + if(verb) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Failed to connect to server with %s\n", af2String(af)); closesocket(socket_server_fd); return TCP_ERROR_PORT; } @@ -220,7 +219,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) { if(count > 30 || stream_check_interrupt(500)) { if(count > 30) - mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnTimeout); + mp_tmsg(MSGT_NETWORK,MSGL_ERR,"connection timeout\n"); else mp_msg(MSGT_NETWORK,MSGL_V,"Connection interrupted by user\n"); return TCP_ERROR_TIMEOUT; @@ -231,7 +230,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { tv.tv_sec = 0; tv.tv_usec = 500000; } - if (ret < 0) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed); + if (ret < 0) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Select failed.\n"); // Turn back the socket as blocking #if !HAVE_WINSOCK2_H @@ -244,11 +243,11 @@ connect2Server_with_af(char *host, int port, int af,int verb) { err_len = sizeof(int); ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len); if(ret < 0) { - mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_GetSockOptFailed,strerror(errno)); + mp_tmsg(MSGT_NETWORK,MSGL_ERR,"getsockopt failed: %s\n",strerror(errno)); return TCP_ERROR_FATAL; } if(err > 0) { - mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnectError,strerror(err)); + mp_tmsg(MSGT_NETWORK,MSGL_ERR,"connect error: %s\n",strerror(err)); return TCP_ERROR_PORT; } |