diff options
author | David 'Digit' Turner <digit@android.com> | 2011-03-21 17:50:20 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-04-11 18:18:53 +0200 |
commit | bb1f432421288dae208c7189356643023ccbffbc (patch) | |
tree | 1df51627d90ee27310f028a0553bea41ba8ff825 /android | |
parent | 8805b422dfaa568213c0909da6da48d24837324f (diff) | |
download | external_qemu-bb1f432421288dae208c7189356643023ccbffbc.zip external_qemu-bb1f432421288dae208c7189356643023ccbffbc.tar.gz external_qemu-bb1f432421288dae208c7189356643023ccbffbc.tar.bz2 |
qemud: prevent recursive closure of clients.
+ add android/hw-qemud-pipe.h
Change-Id: Icf7b316137cd9f1ce46e4c3642addccea6222a24
Diffstat (limited to 'android')
-rw-r--r-- | android/hw-qemud-pipe.h | 22 | ||||
-rw-r--r-- | android/hw-qemud.c | 10 | ||||
-rw-r--r-- | android/hw-qemud.h | 12 |
3 files changed, 36 insertions, 8 deletions
diff --git a/android/hw-qemud-pipe.h b/android/hw-qemud-pipe.h new file mode 100644 index 0000000..540e02b --- /dev/null +++ b/android/hw-qemud-pipe.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _ANDROID_HW_QEMUD_PIPE_H +#define _ANDROID_HW_QEMUD_PIPE_H + +void init_qemud_pipes(void); +void android_hw_opengles_init(void); + +#endif /* _ANDROID_HW_QEMUD_PIPE_H */ diff --git a/android/hw-qemud.c b/android/hw-qemud.c index e1cd119..e91ec78 100644 --- a/android/hw-qemud.c +++ b/android/hw-qemud.c @@ -532,7 +532,7 @@ qemud_serial_send( QemudSerial* s, } /* packetize the payload for the serial MTU */ - while (len > 0) + while (len > 0) { avail = len; if (avail > MAX_SERIAL_PAYLOAD) @@ -600,6 +600,7 @@ struct QemudClient { /* framing support */ int framing; ABool need_header; + ABool closing; QemudSink header[1]; uint8_t header0[FRAME_HEADER_SIZE]; QemudSink payload[1]; @@ -661,7 +662,7 @@ qemud_client_recv( void* opaque, uint8_t* msg, int msglen ) if (len >= 0 && msglen == len + FRAME_HEADER_SIZE) { if (c->clie_recv) - c->clie_recv( c->clie_opaque, + c->clie_recv( c->clie_opaque, msg+FRAME_HEADER_SIZE, msglen-FRAME_HEADER_SIZE, c ); return; @@ -724,6 +725,11 @@ qemud_client_disconnect( void* opaque ) { QemudClient* c = opaque; + if (c->closing) { /* recursive call, exit immediately */ + return; + } + c->closing = 1; + /* remove from current list */ qemud_client_remove(c); diff --git a/android/hw-qemud.h b/android/hw-qemud.h index 18eec6f..cd05737 100644 --- a/android/hw-qemud.h +++ b/android/hw-qemud.h @@ -90,12 +90,12 @@ typedef int (*QemudClientLoad) ( QEMUFile* f, QemudClient* client, void* opaq * (see below). */ extern QemudClient* qemud_client_new( QemudService* service, - int channel_id, - void* clie_opaque, - QemudClientRecv clie_recv, - QemudClientClose clie_close, - QemudClientSave clie_save, - QemudClientLoad clie_load ); + int channel_id, + void* clie_opaque, + QemudClientRecv clie_recv, + QemudClientClose clie_close, + QemudClientSave clie_save, + QemudClientLoad clie_load ); /* Enable framing on a given client channel. */ |