Changes in uspace/srv/hid/remcons/user.c [fab2746:5d94b16c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/remcons/user.c
rfab2746 r5d94b16c 38 38 #include <str_error.h> 39 39 #include <loc.h> 40 #include <event.h> 40 41 #include <io/keycode.h> 41 42 #include <align.h> … … 44 45 #include <fibril_synch.h> 45 46 #include <task.h> 46 #include <inet/tcp.h> 47 #include <net/in.h> 48 #include <net/inet.h> 49 #include <net/socket.h> 47 50 #include <io/console.h> 48 51 #include <inttypes.h> … … 56 59 /** Create new telnet user. 57 60 * 58 * @param conn Incoming connection.61 * @param socket Socket the user communicates through. 59 62 * @return New telnet user or NULL when out of memory. 60 63 */ 61 telnet_user_t *telnet_user_create( tcp_conn_t *conn)64 telnet_user_t *telnet_user_create(int socket) 62 65 { 63 66 static int telnet_user_id_counter = 0; … … 76 79 } 77 80 78 user-> conn = conn;81 user->socket = socket; 79 82 user->service_id = (service_id_t) -1; 80 83 prodcons_initialize(&user->in_events); … … 125 128 126 129 fibril_mutex_lock(&users_guard); 127 list_foreach(users, link, telnet_user_t, tmp) { 130 list_foreach(users, link) { 131 telnet_user_t *tmp = list_get_instance(link, telnet_user_t, link); 128 132 if (tmp->service_id == id) { 129 133 user = tmp; … … 191 195 /* No more buffered data? */ 192 196 if (user->socket_buffer_len <= user->socket_buffer_pos) { 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) { 197 int recv_length = recv(user->socket, user->socket_buffer, BUFFER_SIZE, 0); 198 if ((recv_length == 0) || (recv_length == ENOTCONN)) { 202 199 user->socket_closed = true; 203 200 user->srvs.aborted = true; 204 201 return ENOENT; 205 202 } 206 203 if (recv_length < 0) { 204 return recv_length; 205 } 207 206 user->socket_buffer_len = recv_length; 208 207 user->socket_buffer_pos = 0; … … 362 361 363 362 364 int rc = tcp_conn_send(user->conn, converted, converted_size);363 int rc = send(user->socket, converted, converted_size, 0); 365 364 free(converted); 366 365
Note:
See TracChangeset
for help on using the changeset viewer.