mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Created a shiny new abstraction for the socket handling. Has many
advantages: - protocol modules can call sk_write() without having to worry about writes blocking, because blocking writes are handled in the abstraction layer and retried later. - `Lost connection while sending' is a thing of the past. - <winsock.h> is no longer needed in most modules, because "putty.h" doesn't have to declare `SOCKET' variables any more, only the abstracted `Socket' type. - select()-equivalent between multiple sockets will now be handled sensibly, which opens the way for things like SSH port forwarding. [originally from svn r744]
This commit is contained in:
20
terminal.c
20
terminal.c
@ -1,11 +1,4 @@
|
||||
#include <windows.h>
|
||||
#ifndef AUTO_WINSOCK
|
||||
#ifdef WINSOCK_TWO
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -2150,7 +2143,7 @@ void term_nopaste() {
|
||||
}
|
||||
|
||||
void term_paste() {
|
||||
static long last_paste = 0;
|
||||
static long last_paste = 0;
|
||||
long now, paste_diff;
|
||||
|
||||
if(paste_len == 0) return;
|
||||
@ -2166,10 +2159,15 @@ static long last_paste = 0;
|
||||
|
||||
while(paste_pos<paste_len)
|
||||
{
|
||||
char c = paste_buffer[paste_pos++];
|
||||
ldisc->send (&c, 1);
|
||||
int n = 0;
|
||||
while (n + paste_pos < paste_len) {
|
||||
if (paste_buffer[paste_pos + n++] == '\r')
|
||||
break;
|
||||
}
|
||||
ldisc->send (paste_buffer+paste_pos, n);
|
||||
paste_pos += n;
|
||||
|
||||
if (c =='\r') {
|
||||
if (paste_pos < paste_len) {
|
||||
paste_hold = 1;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user