X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=winnet.c;h=4ea29038623b6e2b3612d64811a2735a890b312a;hb=4756c15fc9556e2f29bdc65594ea15892f9b5d35;hp=068b9b491c124d1764d09e1610c3c8745648d582;hpb=eabd704d1ecf72868794284d0f24e8d69ec9ce76;p=PuTTY.git diff --git a/winnet.c b/winnet.c index 068b9b49..4ea29038 100644 --- a/winnet.c +++ b/winnet.c @@ -368,6 +368,26 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen) #endif } +int sk_addrtype(SockAddr addr) +{ + return addr->family; +} + +void sk_addrcopy(SockAddr addr, char *buf) +{ +#ifdef IPV6 + if (addr->family == AF_INET) { +#endif + struct in_addr a; + a.s_addr = htonl(addr->address); + memcpy(buf, (char*) &a.s_addr, 4); +#ifdef IPV6 + } else { + memcpy(buf, (char*) addr->ai, 16); + } +#endif +} + void sk_addr_free(SockAddr addr) { sfree(addr); @@ -813,7 +833,10 @@ void try_send(Actual_Socket s) s->pending_error = err; return; } else { - fatalbox(winsock_error_string(err)); + /* We're inside the Windows frontend here, so we know + * that the frontend handle is unnecessary. */ + logevent(NULL, winsock_error_string(err)); + fatalbox("%s", winsock_error_string(err)); } } else { if (s->sending_oob) { @@ -949,8 +972,12 @@ int select_result(WPARAM wParam, LPARAM lParam) ret = recv(s->s, buf, sizeof(buf), MSG_OOB); noise_ultralight(ret); if (ret <= 0) { - fatalbox(ret == 0 ? "Internal networking trouble" : - winsock_error_string(WSAGetLastError())); + char *str = (ret == 0 ? "Internal networking trouble" : + winsock_error_string(WSAGetLastError())); + /* We're inside the Windows frontend here, so we know + * that the frontend handle is unnecessary. */ + logevent(NULL, str); + fatalbox("%s", str); } else { return plug_receive(s->plug, 2, buf, ret); }