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