Changeset fb4d788 in mainline for uspace/srv/hid/remcons/user.c


Ignore:
Timestamp:
2015-07-28T11:28:14Z (9 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6accc5cf
Parents:
df2bce3 (diff), 47726b5e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from the mainline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/remcons/user.c

    rdf2bce3 rfb4d788  
    4444#include <fibril_synch.h>
    4545#include <task.h>
    46 #include <net/in.h>
    47 #include <net/inet.h>
    48 #include <net/socket.h>
     46#include <inet/tcp.h>
    4947#include <io/console.h>
    5048#include <inttypes.h>
     
    5856/** Create new telnet user.
    5957 *
    60  * @param socket Socket the user communicates through.
     58 * @param conn Incoming connection.
    6159 * @return New telnet user or NULL when out of memory.
    6260 */
    63 telnet_user_t *telnet_user_create(int socket)
     61telnet_user_t *telnet_user_create(tcp_conn_t *conn)
    6462{
    6563        static int telnet_user_id_counter = 0;
     
    7876        }
    7977
    80         user->socket = socket;
     78        user->conn = conn;
    8179        user->service_id = (service_id_t) -1;
    8280        prodcons_initialize(&user->in_events);
     
    193191        /* No more buffered data? */
    194192        if (user->socket_buffer_len <= user->socket_buffer_pos) {
    195                 int recv_length = recv(user->socket, user->socket_buffer, BUFFER_SIZE, 0);
    196                 if ((recv_length == 0) || (recv_length == ENOTCONN)) {
     193                int rc;
     194                size_t recv_length;
     195
     196                rc = tcp_conn_recv_wait(user->conn, user->socket_buffer,
     197                    BUFFER_SIZE, &recv_length);
     198                if (rc != EOK)
     199                        return rc;
     200
     201                if (recv_length == 0) {
    197202                        user->socket_closed = true;
    198203                        user->srvs.aborted = true;
    199204                        return ENOENT;
    200205                }
    201                 if (recv_length < 0) {
    202                         return recv_length;
    203                 }
     206
    204207                user->socket_buffer_len = recv_length;
    205208                user->socket_buffer_pos = 0;
     
    359362
    360363
    361         int rc = send(user->socket, converted, converted_size, 0);
     364        int rc = tcp_conn_send(user->conn, converted, converted_size);
    362365        free(converted);
    363366
Note: See TracChangeset for help on using the changeset viewer.