diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-26 21:39:08 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2011-12-26 21:39:08 -0800 |
commit | 7c7aba1202a2c205facd64ab728dcb9472a0b6e1 (patch) | |
tree | dd96494b7229fcc6e1a5a6954bf33728ebadc0b4 /env_universal_common.cpp | |
parent | 74a1d70b8a713db1c56b0e521e7e62dbda7e7a37 (diff) |
Fix to migrate the universal variable server off of dyn_queue_t
Diffstat (limited to 'env_universal_common.cpp')
-rw-r--r-- | env_universal_common.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/env_universal_common.cpp b/env_universal_common.cpp index 296baa5c..50d72857 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -658,7 +658,7 @@ static void parse_message( wchar_t *msg, { message_t *msg = create_message( BARRIER_REPLY, 0, 0 ); msg->count = 1; - q_put( &src->unsent, msg ); + src->unsent->push(msg); try_send_all( src ); } else if( match( msg, BARRIER_REPLY_STR ) ) @@ -728,12 +728,12 @@ void try_send_all( connection_t *c ) /* debug( 3, L"Send all updates to connection on fd %d", c->fd );*/ - while( !q_empty( &c->unsent) ) + while( !c->unsent->empty() ) { - switch( try_send( (message_t *)q_peek( &c->unsent), c->fd ) ) + switch( try_send( c->unsent->front(), c->fd ) ) { case 1: - q_get( &c->unsent); + c->unsent->pop(); break; case 0: @@ -951,19 +951,18 @@ static void enqueue( void *k, { const wchar_t *key = (const wchar_t *)k; const var_uni_entry_t *val = (const var_uni_entry_t *)v; - dyn_queue_t *queue = (dyn_queue_t *)q; + message_queue_t *queue = (message_queue_t *)q; message_t *msg = create_message( val->exportv?SET_EXPORT:SET, key, val->val ); msg->count=1; - - q_put( queue, msg ); + queue->push(msg); } void enqueue_all( connection_t *c ) { hash_foreach2( &env_universal_var, &enqueue, - (void *)&c->unsent ); + (void *)c->unsent ); try_send_all( c ); } @@ -973,13 +972,13 @@ void connection_init( connection_t *c, int fd ) memset (c, 0, sizeof (connection_t)); c->fd = fd; b_init( &c->input ); - q_init( &c->unsent ); + c->unsent = new std::queue<message_t *>; c->buffer_consumed = c->buffer_used = 0; } void connection_destroy( connection_t *c) { - q_destroy( &c->unsent ); + if (c->unsent) delete c->unsent; b_destroy( &c->input ); /* |