mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-23 01:51:58 +00:00
Add sanity check and extra debug message
This commit is contained in:
parent
63719deea9
commit
3acd51597a
@ -277,6 +277,7 @@ static void tcp_close ( struct tcp_connection *tcp, int rc ) {
|
||||
stop_timer ( &tcp->timer );
|
||||
list_del ( &tcp->list );
|
||||
ref_put ( &tcp->refcnt );
|
||||
DBGC ( tcp, "TCP %p connection deleted\n", tcp );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -980,6 +981,10 @@ struct socket_opener tcp_socket_opener __socket_opener = {
|
||||
static int tcp_open_uri ( struct xfer_interface *xfer, struct uri *uri ) {
|
||||
struct sockaddr_tcpip peer;
|
||||
|
||||
/* Sanity check */
|
||||
if ( ! uri->host )
|
||||
return -EINVAL;
|
||||
|
||||
memset ( &peer, 0, sizeof ( peer ) );
|
||||
peer.st_port = htons ( uri_port ( uri, 0 ) );
|
||||
return xfer_open_named_socket ( xfer, SOCK_STREAM,
|
||||
|
Loading…
Reference in New Issue
Block a user