src/sock_test.c
changeset 42 13cfc41f76a7
parent 41 40f7aa051acb
child 43 42f5dc680930
equal deleted inserted replaced
41:40f7aa051acb 42:13cfc41f76a7
   126 }
   126 }
   127 
   127 
   128 static err_t sock_test_event_enable (struct sock_stream *base_sock, short mask)
   128 static err_t sock_test_event_enable (struct sock_stream *base_sock, short mask)
   129 {
   129 {
   130     struct sock_test *sock = SOCK_FROM_BASE(base_sock, struct sock_test);
   130     struct sock_test *sock = SOCK_FROM_BASE(base_sock, struct sock_test);
       
   131 
       
   132     // store mask
       
   133     sock->ev_mask = mask;
   131 
   134 
   132     return SUCCESS;
   135     return SUCCESS;
   133 }
   136 }
   134 
   137 
   135 static void sock_test_release (struct sock_stream *base_sock)
   138 static void sock_test_release (struct sock_stream *base_sock)
   210     // ensure there's room
   213     // ensure there's room
   211     assert(sock_test_grow_buf(buf) == SUCCESS);
   214     assert(sock_test_grow_buf(buf) == SUCCESS);
   212     
   215     
   213     // copy    
   216     // copy    
   214     *(buf->write_vec++) = new_vec;
   217     *(buf->write_vec++) = new_vec;
       
   218 
       
   219     // notify events?
       
   220     if (sock->ev_mask) {
       
   221         int mask = sock->ev_mask;
       
   222         sock->ev_mask = 0;
       
   223 
       
   224         sock_stream_invoke_callbacks(SOCK_TEST_BASE(sock), mask);
       
   225     }
   215 }
   226 }
   216 
   227 
   217 void sock_test_get_send_data (struct sock_test *sock, char **buf_ptr, size_t *len_ptr)
   228 void sock_test_get_send_data (struct sock_test *sock, char **buf_ptr, size_t *len_ptr)
   218 {
   229 {
   219     struct io_buf *buf = &sock->send_buf;
   230     struct io_buf *buf = &sock->send_buf;