Use random name for device socket
For the initial connection between the device and the computer, an adb
tunnel is established (with "adb reverse" or "adb forward").
The device-side of the tunnel is a local socket having the hard-coded
name "scrcpy". This may cause issues when several scrcpy instances are
started in a few seconds for the same device, since they will try to
bind the same name.
To avoid conflicts, make the client generate a random UID, and append
this UID to the local socket name ("scrcpy_01234567").
This commit is contained in:
@@ -22,6 +22,7 @@ struct sc_server_info {
|
||||
};
|
||||
|
||||
struct sc_server_params {
|
||||
uint32_t uid;
|
||||
const char *req_serial;
|
||||
enum sc_log_level log_level;
|
||||
const char *crop;
|
||||
@@ -54,6 +55,7 @@ struct sc_server {
|
||||
// The internal allocated strings are copies owned by the server
|
||||
struct sc_server_params params;
|
||||
char *serial;
|
||||
char *device_socket_name;
|
||||
|
||||
sc_thread thread;
|
||||
struct sc_server_info info; // initialized once connected
|
||||
|
||||
Reference in New Issue
Block a user