Displaying 1 result from an estimated 1 matches for "handle_read_fd".
2006 Sep 06
7
[RFC PATCH] allow connecting to xenconsole from remote hosts
...1 != m2->len)
+ return 0;
+
+ ret = !memcmp(m1, m2->data, len1);
+
+ return ret;
+}
+
+static inline void dump_msg(char* prefix, int fd, const char *data, size_t len)
+{
+ dbg("%s: %u bytes on %d:\n", prefix, len, fd);
+ dbg("msg: `%s''\n", data);
+}
+
+static int handle_read_fd(int fd, struct queue* q, struct queue* discard)
+{
+ int ret;
+ ssize_t len;
+ char *msg;
+ struct message *msg_to_discard;
+
+ msg = malloc(MSG_SIZE);
+ if (!msg)
+ return -ENOMEM;
+
+ len = read(fd, msg, MSG_SIZE);
+ if (len == 1 && msg[0] == ESCAPE_CHARACTER) {
+ ret = ECONNRESET;
+ g...