projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add the missing "all" target in the Cygwin makefile
[u/mdw/putty]
/
raw.c
diff --git
a/raw.c
b/raw.c
index
2abc0a8
..
7990d1d
100644
(file)
--- a/
raw.c
+++ b/
raw.c
@@
-24,18
+24,17
@@
static void c_write (char *buf, int len) {
from_backend(0, buf, len);
}
from_backend(0, buf, len);
}
-static int raw_receive (Socket s, int urgent, char *data, int len) {
- if (urgent==3) {
+static int raw_closing (Plug plug, char *error_msg, int error_code, int calling_back) {
+ sk_close(s);
+ s = NULL;
+ if (error_msg) {
/* A socket error has occurred. */
/* A socket error has occurred. */
- connection_fatal(data);
- len = 0;
- }
- if (!len) {
- /* Connection has closed. */
- sk_close(s);
- s = NULL;
- return 0;
- }
+ connection_fatal (error_msg);
+ } /* Otherwise, the remote side closed the connection normally. */
+ return 0;
+}
+
+static int raw_receive (Plug plug, int urgent, char *data, int len) {
c_write(data, len);
return 1;
}
c_write(data, len);
return 1;
}
@@
-48,6
+47,11
@@
static int raw_receive (Socket s, int urgent, char *data, int len) {
* Also places the canonical host name into `realhost'.
*/
static char *raw_init (char *host, int port, char **realhost) {
* Also places the canonical host name into `realhost'.
*/
static char *raw_init (char *host, int port, char **realhost) {
+ static struct plug_function_table fn_table = {
+ raw_closing,
+ raw_receive
+ }, *fn_table_ptr = &fn_table;
+
SockAddr addr;
char *err;
SockAddr addr;
char *err;
@@
-64,7
+68,7
@@
static char *raw_init (char *host, int port, char **realhost) {
/*
* Open socket.
*/
/*
* Open socket.
*/
- s = sk_new(addr, port, 0,
raw_receive
);
+ s = sk_new(addr, port, 0,
1, &fn_table_ptr
);
if ( (err = sk_socket_error(s)) )
return err;
if ( (err = sk_socket_error(s)) )
return err;