mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 19:42:48 -05:00
FdSocket, HandleSocket: store a notional peer address.
In the case where these socket types are constructed because of a local proxy command, we do actually have a SockAddr representing the logical host we were trying to make a connection to. So we might as well store it in the socket implementation, and then we can include it in the PLUGLOG_CONNECT_SUCCESS call to make the log message more informative.
This commit is contained in:
@ -40,6 +40,8 @@ typedef struct HandleSocket {
|
||||
|
||||
char *error;
|
||||
|
||||
SockAddr *addr;
|
||||
int port;
|
||||
Plug *plug;
|
||||
|
||||
Socket sock;
|
||||
@ -128,6 +130,9 @@ static void sk_handle_close(Socket *s)
|
||||
CloseHandle(hs->recv_H);
|
||||
bufchain_clear(&hs->inputdata);
|
||||
|
||||
if (hs->addr)
|
||||
sk_addr_free(hs->addr);
|
||||
|
||||
delete_callbacks_for_context(hs);
|
||||
|
||||
sfree(hs);
|
||||
@ -317,17 +322,20 @@ static const SocketVtable HandleSocket_sockvt = {
|
||||
static void sk_handle_connect_success_callback(void *ctx)
|
||||
{
|
||||
HandleSocket *hs = (HandleSocket *)ctx;
|
||||
plug_log(hs->plug, PLUGLOG_CONNECT_SUCCESS, NULL, 0, NULL, 0);
|
||||
plug_log(hs->plug, PLUGLOG_CONNECT_SUCCESS, hs->addr, hs->port, NULL, 0);
|
||||
}
|
||||
|
||||
Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
|
||||
Plug *plug, bool overlapped)
|
||||
SockAddr *addr, int port, Plug *plug,
|
||||
bool overlapped)
|
||||
{
|
||||
HandleSocket *hs;
|
||||
int flags = (overlapped ? HANDLE_FLAG_OVERLAPPED : 0);
|
||||
|
||||
hs = snew(HandleSocket);
|
||||
hs->sock.vt = &HandleSocket_sockvt;
|
||||
hs->addr = addr;
|
||||
hs->port = port;
|
||||
hs->plug = plug;
|
||||
hs->error = NULL;
|
||||
hs->frozen = UNFROZEN;
|
||||
|
Reference in New Issue
Block a user