Changes in uspace/srv/net/tcp/test.c [69a93df7:a2e3ee6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/test.c
r69a93df7 ra2e3ee6 38 38 #include <errno.h> 39 39 #include <stdio.h> 40 #include < thread.h>40 #include <fibril.h> 41 41 #include <str.h> 42 42 #include "tcp_type.h" … … 47 47 #define RCV_BUF_SIZE 64 48 48 49 static voidtest_srv(void *arg)49 static int test_srv(void *arg) 50 50 { 51 51 tcp_conn_t *conn; … … 57 57 58 58 printf("test_srv()\n"); 59 60 inet_addr(&lsock.addr, 127, 0, 0, 1); 59 61 lsock.port = 80; 60 lsock.addr.ipv4 = 0x7f000001; 62 63 inet_addr(&fsock.addr, 127, 0, 0, 1); 61 64 fsock.port = 1024; 62 fsock.addr.ipv4 = 0x7f000001;65 63 66 printf("S: User open...\n"); 64 67 tcp_uc_open(&lsock, &fsock, ap_passive, 0, &conn); … … 84 87 85 88 printf("test_srv() terminating\n"); 89 return 0; 86 90 } 87 91 88 static voidtest_cli(void *arg)92 static int test_cli(void *arg) 89 93 { 90 94 tcp_conn_t *conn; … … 94 98 95 99 printf("test_cli()\n"); 96 100 101 inet_addr(&lsock.addr, 127, 0, 0, 1); 97 102 lsock.port = 1024; 98 lsock.addr.ipv4 = 0x7f000001; 103 104 inet_addr(&fsock.addr, 127, 0, 0, 1); 99 105 fsock.port = 80; 100 fsock.addr.ipv4 = 0x7f000001;101 106 102 107 async_usleep(1000*1000*3); … … 112 117 printf("C: User close...\n"); 113 118 tcp_uc_close(conn); 119 120 return 0; 114 121 } 115 122 116 123 void tcp_test(void) 117 124 { 118 thread_id_t srv_tid; 119 thread_id_t cli_tid; 120 int rc; 125 fid_t srv_fid; 126 fid_t cli_fid; 121 127 122 128 printf("tcp_test()\n"); … … 125 131 126 132 if (0) { 127 rc = thread_create(test_srv, NULL, "test_srv", &srv_tid);128 if ( rc != EOK) {129 printf("Failed to create server thread.\n");133 srv_fid = fibril_create(test_srv, NULL); 134 if (srv_fid == 0) { 135 printf("Failed to create server fibril.\n"); 130 136 return; 131 137 } 138 139 fibril_add_ready(srv_fid); 132 140 } 133 141 134 142 if (0) { 135 rc = thread_create(test_cli, NULL, "test_cli", &cli_tid);136 if ( rc != EOK) {137 printf("Failed to create client thread.\n");143 cli_fid = fibril_create(test_cli, NULL); 144 if (cli_fid == 0) { 145 printf("Failed to create client fibril.\n"); 138 146 return; 139 147 } 148 149 fibril_add_ready(cli_fid); 140 150 } 141 151 }
Note:
See TracChangeset
for help on using the changeset viewer.