From 5a41435e45ae18c0823780382c214fb7324dbe7d Mon Sep 17 00:00:00 2001 From: Øyvind Harboe Date: Mon, 27 Sep 2010 08:26:31 +0200 Subject: server: split file descriptors in in/out fd's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pipes have different fd's for in/out. This makes the code more orthogonal and prepares for adding pipes. Signed-off-by: Øyvind Harboe --- src/server/gdb_server.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/server/gdb_server.c') diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 76c3e363..7343b87c 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -176,7 +176,7 @@ static int gdb_get_char_inner(struct connection *connection, int* next_char) #endif for (;;) { - if (connection->service->type == CONNECTION_PIPE) + if (connection->service->type != CONNECTION_TCP) { gdb_con->buf_cnt = read(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE); } @@ -328,20 +328,9 @@ static int gdb_write(struct connection *connection, void *data, int len) if (gdb_con->closed) return ERROR_SERVER_REMOTE_CLOSED; - if (connection->service->type == CONNECTION_PIPE) + if (write_socket(connection->fd_out, data, len) == len) { - /* write to stdout */ - if (write(STDOUT_FILENO, data, len) == len) - { - return ERROR_OK; - } - } - else - { - if (write_socket(connection->fd, data, len) == len) - { - return ERROR_OK; - } + return ERROR_OK; } gdb_con->closed = 1; return ERROR_SERVER_REMOTE_CLOSED; -- cgit v1.2.3