CN111416849B - Disconnection reconnection method, device and system and computer equipment - Google Patents

Disconnection reconnection method, device and system and computer equipment Download PDF

Info

Publication number
CN111416849B
CN111416849B CN202010175673.6A CN202010175673A CN111416849B CN 111416849 B CN111416849 B CN 111416849B CN 202010175673 A CN202010175673 A CN 202010175673A CN 111416849 B CN111416849 B CN 111416849B
Authority
CN
China
Prior art keywords
connection
client
game
server
session
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010175673.6A
Other languages
Chinese (zh)
Other versions
CN111416849A (en
Inventor
吕骁博
曾涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010175673.6A priority Critical patent/CN111416849B/en
Publication of CN111416849A publication Critical patent/CN111416849A/en
Application granted granted Critical
Publication of CN111416849B publication Critical patent/CN111416849B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/131Protocols for games, networked simulations or virtual reality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a disconnection reconnection method, a disconnection reconnection device, a disconnection reconnection system and computer equipment. The method comprises the following steps: when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client; restoring the first connection according to the session; if the second connection to be recovered exists, acquiring a connection address of the second connection; the connection address is obtained by the first game service process from the second game service process; and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection. According to the scheme, under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through inter-process communication, and the synchronization of player data on different game business processes can be effectively guaranteed.

Description

Disconnection reconnection method, device and system and computer equipment
Technical Field
The present application relates to the field of network connection technologies, and in particular, to a method, an apparatus, a system, and a computer device for reconnection after disconnection.
Background
In recent years, as the scale of the game industry has been expanded, the number of players and the online time have been increased. At present, network interruption of network games running on electronic equipment occurs under many conditions, such as game flash back, phone answering, network switching, and the like, and at this time, disconnection and reconnection are required so as to enable game application programs to run more smoothly.
In the traditional game framework, disconnection reconnection only considers the case of a single connection, namely that a client is connected with an Entity (independent game background server process Entity) in a server. In a complex practical application scenario, there may be multiple connections. In this case, if the disconnection reconnection is performed in a conventional single connection manner, the player data in different entitlements may be out of synchronization, and internal data errors (such as repeated top numbers, abnormal login, and the like) may be caused.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present invention and therefore may include information that does not constitute prior art known to a person of ordinary skill in the art.
Disclosure of Invention
In view of the above, it is desirable to provide a disconnection reconnection method, apparatus, system, computer device, and storage medium capable of sequentially reconnecting a plurality of connections when the connections are present.
A disconnection reconnection method is applied to a server side and comprises the following steps: when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process; and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
A disconnection reconnection method is applied to a client, and comprises the following steps: sending a disconnection reconnection request to a connection management process of a server to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired from the second game business process by the first game business process; receiving the connection address returned by the connection management process through the first connection; restoring the second connection through the connection address.
A disconnection reconnection device is applied to a server side and comprises: the session determining module is used for determining a session corresponding to a client when a disconnection reconnection request sent by the client through a connection management process is received; the first connection recovery module is used for recovering the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process; the connection address acquisition module is used for acquiring a connection address of a second connection to be recovered if the second connection is determined to exist; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process; and the second connection recovery module is used for triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
In one embodiment, the connection address obtaining module is further configured to obtain the connection address obtained by the first game service process from the second game service process through a communication channel; the communication channel includes at least one of a shared memory and a remote process communication agent.
In one embodiment, the apparatus further comprises: a historical connection determining module, configured to determine, according to the session, a historical connection corresponding to the client; the historical connection is the connection between the first game business process and the client before disconnection; a connection information obtaining module, configured to obtain uplink connection information and downlink connection information corresponding to the historical connection; a connection information migration module, configured to migrate the uplink connection information and the downlink connection information to the first connection; and the connection closing module is used for triggering the connection management process to close the historical connection.
In one embodiment, the apparatus further comprises: the session establishing module is used for establishing a session corresponding to the client if the session does not exist; and the connection reestablishment module is used for reestablishing the connection between the first game service process and the client through the newly-established session.
In one embodiment, the apparatus further comprises: and the service process selection module is used for controlling the first game service process to select the second game service process from at least one candidate game service process in a load balancing mode before disconnection.
In one embodiment, the apparatus further comprises: the connection state acquisition module is used for acquiring a historical connection state; the historical connection state is the connection state between the client and the at least one candidate game service process before disconnection; and the connection judging module is used for determining whether the second connection exists according to the historical connection state.
In one embodiment, the apparatus further comprises: the heartbeat time updating module is used for updating the heartbeat time of the corresponding session according to the heartbeat packet if the heartbeat packet sent by the client is received; the heartbeat packet is sent by the client regularly; the session and state processing module is used for recovering the corresponding session and setting the corresponding game account to be in an off-line state if the heartbeat packet sent by the client is not received within a set time period; the game account is an account registered in the server by the client.
A disconnection reconnection device applied to a client side comprises: the reconnection request sending module is used for sending a disconnection reconnection request to a connection management process of a server so as to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired from the second game business process by the first game business process; a connection address receiving module, configured to receive the connection address returned by the connection management process through the first connection; and the connection recovery module is used for recovering the second connection through the connection address.
In one embodiment, the apparatus further comprises: the frame tracking request sending module is used for sending a frame tracking request to the server; the frame tracking request is used for triggering the server to acquire a target data frame from at least one data frame; the at least one data frame is a data frame which meets a preset condition in a game fighting mode of a game application program; the context calculation module is used for receiving the target data frame sent by the server and calculating the context information of the target data frame; the state information acquisition module is used for acquiring the state information of the game application program at the current moment from the server; and the frame tracking repeating module is used for continuously sending a frame tracking request to the server side if the context information is not matched with the state information, repeating the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovering the game fighting mode.
In one embodiment, the apparatus further comprises: an initialization request sending module, configured to send an initialization request to the server; the initialization request is used for triggering the server to acquire initialization information of the game application program; and the initialization module is used for carrying out initialization operation according to the initialization information returned by the server.
In one embodiment, if the server is the server where the game application program is located, the server communicates with a game service process in the server through an internal connection management process; if the server is an external platform, communicating with a game service process in the external platform through an external connection agent process; the external platform is independent of a server on which the game application resides.
A system for disconnection and reconnection, the system comprising: a server and a client; the server comprises a first game service process, a second game service process and a connection management process; the client is used for sending a disconnection reconnection request to a connection management process of the server; the connection management process is used for determining a session corresponding to the client and recovering a first connection according to the session; the first connection is formed by the first game business process and the client through the connection management process; the first game business process is used for acquiring a connection address of a second connection from the second game business process if the second connection to be recovered is determined to exist; the second connection is a connection between the second game business process and the client; the connection management process is further configured to return the connection address to the client through the first connection; the client is further used for recovering the second connection through the connection address.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process; and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process; and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of: when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process; and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of: sending a disconnection reconnection request to a connection management process of a server to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired from the second game business process by the first game business process; receiving the connection address returned by the connection management process through the first connection; restoring the second connection through the connection address.
According to the disconnection reconnection method, the disconnection reconnection device, the disconnection reconnection system, the computer equipment and the storage medium, when disconnection occurs, the client sends a disconnection reconnection request to the connection management process, the server is triggered to recover the first connection between the first game service process and the client, and the connection address between the second game service process and the client is returned to the client through the first connection so as to recover the second connection between the second game service process and the client. Under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through interprocess communication, so that the synchronization of player data on different game business processes can be effectively ensured.
Drawings
FIG. 1 is a diagram of an exemplary implementation of a disconnection reconnect method;
FIG. 2 is a schematic diagram of an interface display of a client in one embodiment;
FIG. 3 is a flow chart illustrating a disconnection reconnecting method according to an embodiment;
FIG. 4 is a diagram of an application environment of the disconnection reconnecting method in another embodiment;
FIG. 5 is a flow chart illustrating a disconnection reconnecting method according to another embodiment;
FIG. 6 is a schematic flow chart diagram illustrating a disconnection reconnecting method according to yet another embodiment;
FIG. 7 is a timing diagram of the disconnection reconnect method in one embodiment;
FIG. 8 is a block diagram of an exemplary embodiment of a disconnection reconnecting device;
FIG. 9 is a block diagram of an embodiment of a disconnection reconnecting device;
FIG. 10 is a block diagram of the disconnection reconnecting system in one embodiment;
FIG. 11 is a diagram of the internal structure of a computer device in one embodiment;
fig. 12 is an internal structural view of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The disconnection reconnection method provided by the application can be applied to the application environment shown in fig. 1. The application environment includes a client 101 and a server 102, which can communicate via a network. The server side comprises a first game business process, a second game business process and a connection management process. When the game application program normally runs, the first game business process is connected with the client through the connection management process (the client is also connected with the second game business process through another connection management process, which is not shown in fig. 1), and in addition, the first game business process and the second game business process can be communicated. When a network disconnection occurs, the connection between the client and the connection management process is cut off, and each game service process cannot perform normal communication with the client (as shown in fig. 2, at this time, the content of "reconnection … …" can be displayed on the client interface), and disconnection reconnection is required at this time.
The client 101 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, various types of game applications may be installed in the client 101, and the server 102 may be a server (to be noted, in the embodiment of the method of the present invention, it is simply referred to as "server") that provides the game applications, or an external platform (i.e., the server and a third end other than the client, in which case the client may run the game applications in the server by means of the external platform). The server may be implemented by an independent server or a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 3, a disconnection reconnection method is provided, and is applied to a server, which can be developed by using languages such as C + +, gold (parallel programming language for server implementation).
The method comprises the following steps:
s301, when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client.
The client can install a game application program or can access a web game, and furthermore, the users using the client can register and log in an account in the game application program (which may include a mobile phone game, a web game, an internet game, and the like), and the game application program can be started through the registered or logged-in account. In some embodiments, the client may also specifically refer to a game account registered in the game application.
The server can independently run business process entities in the background, which can be referred to as entities. Further, the number of entities may be more than one, for example, including a first game business process and a second game business process. The first game business process may refer to a business process providing basic functions in the server, such as a business process managing a game hall and a room; the second game business process may refer to an additional function provided in the server, such as a business process of managing a copy, a fighting state.
In some embodiments, the game service process may also be a game service process in an external platform, the game service process in the server may be determined as the first game service process, and the game service process in the external platform may be determined as the second game service process, and vice versa, the game service process in the external platform may be determined as the first game service process, and the game service process in the game server may be determined as the second game service process. In addition, the external platform may be a WeChat platform, a QQ platform, or the like. The game service process in the external platform is consistent with the game service process in the server in the implementation process of disconnection reconnection of the game service process, for example: in the disconnection reconnection process, firstly, the connection C between the client and the game business process in the external platform is recovered, and the connection D between the client and other game business processes is recovered through the connection C.
The connection management process may refer to a process of a connection relationship between a server and a client, and may be Connd, where Connd is one of game process instances in a server, and is used to establish and maintain a connection between the client and a game service process in the server, and perform communication through Gobus (shared memory communication channel between processes) and Entity. In addition, when the external platform exists, the connection management process may refer to an external connection agent process (Relaysvr) for managing message communication between the client and an external connection service in the external platform, the Relaysvr and the Entity in the server communicate through an inter-process communication pipe, and in addition, the game service process in the external platform and the game service process in the server may communicate through a remote process communication agent. Furthermore, a Connd may correspond to a game service process, all messages of the game service process and the client may be forwarded through a connection management process in the connection layer, and the game service process does not directly communicate with the client.
A session refers to a data structure and related operations for a server to manage a connection, and is an actual management structure connected in an upper-level Entity. After the server receives the notification of the connect (the notification may refer to a disconnection reconnection request, where the request includes identification information of the client), a session corresponding to the connection is searched according to the identification information of the client, and if the session exists, this indicates that the connection is a disconnection reconnection (or a top number), and the session can control and manage the connection, so that the server can manage the connection information corresponding to the connection through the session.
Wherein, broken reconnection can refer to complete reconnection and partial reconnection. Specifically, "fully reconnect" means that the client completely loses the context of the game and cannot know the current state of the game application, for example: killing process re-logging, shutting down and restarting and the like; the term "partial reconnection" refers to the disconnection and reconnection after the client still retains partial game context, for example, the network flashes the Wifi network to switch to the 4G network.
S302, recovering the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process.
The game can be various games needing network connection, and a game player (which can refer to a game account logged in a client) can have the situation that the connection between the client and the server is switched under the situations of game flash quit, phone answering, network switching and the like, at this time, if the game player needs to continue playing, the connection between the client and the server needs to be reestablished, namely disconnection reconnection is realized, after the disconnection reconnection is completed, the client can continue to communicate with the server, and further the game state before disconnection can be recovered (or the current state of a game application program in the client, including the states of other game players and the like, can be recovered).
The connection refers to an end-to-end communication channel established between the client and the server, and specifically may refer to a connection of a game service process in the client and the server. In addition, the connection may also refer to not only an end-to-end connection, for example, a game service process may be connected to a client through a connection management process. The connection may be a Websocket (http protocol-based application layer protocol for keeping a long connection between the game service process and the client), a TCP connection, a reliable UDP connection, or the like. Specifically, the first connection refers to a connection between the first game business process and the client. Before disconnection, historical connection exists between the first game business process and the client, the historical connection is cut off (mainly, the connection between the client and the connection management process is cut off) when the disconnection occurs, and at the moment, the connection between the client and each game business process needs to be restored by restoring the connection between the client and the connection management process.
The server side of the step restores the first connection under the triggering of the disconnection reconnection request, and can restore the communication between the first game service process and the client side. Further, the restoring of the first connection may be implemented by a processor (which may be independent of the first game service process, the second game service process, and the connection management process) in the server, or may be implemented directly by the connection management process. Specifically, there may be at least two implementations: 1. when a processor in the server receives a disconnection reconnection request, triggering a connection management process to recover the connection between the first game service process and the client; 2. and when receiving the disconnection reconnection request, the connection management process directly restores the first connection. Specifically, when the client sends the disconnection reconnection request, the disconnection reconnection request is sent through a new connection L1, when the connection management process receives the disconnection reconnection request, a corresponding session is determined according to client identification information included in the disconnection reconnection request, a connection L2 corresponding to the client is determined from the session, L2 is a connection between the first game service process and the connection management process, a correspondence between L1 and L2 is established, when the first game service process sends information related to the client through L1, the connection management process can send through L2, and at this time, the connection between the first game service process and the client is restored.
S303, if the second connection to be recovered is determined to exist, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process.
After the game application program is started, the first game business process and the second game business process can communicate through a specific communication channel so as to realize frame synchronization. Further, assuming that the first game service process is Roomsvr, which is one of game process instances in the server and is used for processing peripheral transactions, the second game service process is Battlesvr, which is one of game process instances in the server and is used for processing battle transactions, and the client establishes a connection with Battlesvr when the player enters a copy or battle. The Roomsvr and the Battlesvr can communicate through a communication channel, the Roomsvr can know the state of a player in a copy or a battle from the Battlesvr and can know the connection information of the Battlesvr and the client, and the connection information can include connection state (disconnection, and the like), connection address, and the like.
If there is a connection (i.e., a second connection) between the second game service process and the client, the second connection needs to be recovered, and the connection management process is not directly connected to the second game service process, so there may be no connection address of the second connection in the connection management process. Therefore, the connection address of the second connection needs to be acquired, and the first game service process can acquire the connection address of the second connection through a communication channel with the second game service process, so that the connection management process can acquire the connection address of the second connection based on the connection address. Further, the connection address may be a URL (uniform resource locator) or the like.
In some embodiments, the first game business process and the second game business process can each be at least one. For convenience of description, a first game process (the number of second game processes is not limited) is taken as an example for explanation.
In this step, the first game service process acquires the connection address of the second connection from the second game service process, and the second game service process does not need to communicate with the client, that is, the server only needs to pay attention to the connection condition of a certain game service process and the client in the disconnection reconnection process, and does not need to receive the connection request sent by the client and perform connection switching and other operations for many times. Further, in some embodiments, the first connection may be referred to as a master connection and, correspondingly, the second connection may be referred to as a slave connection, the slave connection relying on the master connection for recovery.
S304, triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
This step may be performed by the processor in the server or the first game service process returning the connection address to the client. After receiving the connection address, the client can access the connection address to further realize second connection with the second game service process.
In the disconnection reconnection method for the game provided in the above embodiment, when a disconnection occurs, the client sends a disconnection reconnection request to the connection management process, the first connection between the first game service process and the client is restored through the connection management process, and the connection address between the second game service process and the client is returned to the client through the first connection, so as to restore the second connection between the second game service process and the client. Under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through interprocess communication, so that the synchronization of player data on different game business processes can be effectively ensured.
In one embodiment, the step of obtaining the connection address of the second connection includes: acquiring the connection address acquired by the first game service process from the second game service process through a communication channel; the communication channel includes at least one of a shared memory and a remote process communication agent.
The first game service process may obtain connection information of the second game service process through the communication channel, where the connection information may include a connection state (which may be connected or disconnected) of the second game service process and each client, a connection address, connection setup time, connection disconnection time, and the like.
When the server is a server corresponding to the game application, the shared memory may be Gobus, and the remote procedure communication agent may be Gobusd [ a communication agent for cross-machine RPC (remote procedure call) ]. Fig. 4 is an application scenario of the disconnection reconnection method, in which the first game service process Roomsvr and Battlesvr communicate with each other through Gobusd, and the game state of the connected client and the connection information with the client can be synchronized in real time between Roomsvr and Battlesvr, so that the states of the players in the game service processes are consistent. The game state may refer to a state formed by all players after performing interactive operations in the game application, and may be a level, a location (e.g., in a game hall, in a room, in a copy, in combat, etc.), equipment status, player information (e.g., camp, hero, blood volume, etc.), a random seed, and the like of each player.
In the above embodiment, the first game service process and the second game service process are connected through the communication channel, and in the disconnection reconnection process, the connection management process connected with the second game service process is not needed to perform connection management, and the connection management process corresponding to the first game service process recovers the first connection, so that the second connection is recovered through the first connection, thereby reducing the communication cost between the client and the game service process and improving the disconnection reconnection efficiency.
In some embodiments, when the combat is completed and the player is offline, the connection state of the player is synchronized among the game business processes of the server.
In one embodiment, after the step of recovering the first connection according to the session, the method further includes: determining historical connection corresponding to the client according to the session; the historical connection is the connection between the first game business process and the client before disconnection; acquiring uplink connection information and downlink connection information corresponding to the historical connection; migrating the uplink connection information and the downlink connection information to the first connection; and triggering the connection management process to close the historical connection.
The uplink connection information may refer to information sent by the client to the game service process in the server through the historical connection, and the downlink connection information may refer to information sent by the game service process in the server to the client through the historical connection. In this embodiment, the uplink and downlink connection information is migrated to the first connection, so that the communication between the first game service process and the client can be effectively recovered, and the first game service process and the client can conveniently acquire historical transmission data.
The historical connection is cut off when the line is broken, and then the client communicates with the game business process through a new connection, so that the historical connection does not need to be occupied continuously, and the server can recycle the historical connection to improve the utilization rate of connection resources. Further, the operation of closing the historical connection may be performed by a processor in the server. The operation of closing the historical connection may also be performed by a connection management process, in particular, when it is determined that a session exists, Connd closes the old connection, replaces it with the new connection, and migrates the upstream and downstream messages into the new connection.
Further, in some embodiments, in the process of recovering the second connection, the Connd may also close the original old connection and implement migration of the uplink and downlink messages when there is a session corresponding to the client and the second game service process.
The embodiment reasonably processes the old connection and the message corresponding to the old connection under the condition of recovering the new connection, can effectively recover the communication between the game business process and the client, and realizes effective disconnection reconnection.
In some embodiments, the disconnection reconnection method further comprises: if a heartbeat packet sent by the client is received, updating the heartbeat time of the corresponding session according to the heartbeat packet; the heartbeat packet is sent by the client regularly; if the heartbeat packet sent by the client is not received within a set time period, recovering the corresponding session, and setting the corresponding game account to be in an offline state; the game account is an account registered in the server by the client. Specifically, the client may send a heartbeat packet to the server periodically, and the server may determine that the client operates normally after receiving the heartbeat packet of the client, and may update the heartbeat time of the client. On the other hand, the server can monitor the heartbeat time of each client in real time, determine the heartbeat time which is not updated for a long time, clear the sessions corresponding to the heartbeat time, thoroughly cut off the connection between the client and the corresponding game business process after the sessions are cleared, and simultaneously set the player state corresponding to the client to be an offline state. Specifically, the server triggers the corresponding game logic when the heartbeat packet is not received within a timeout, for example, the state of the player is set to "leave the room" or "fight run".
In some embodiments, if the session is cleared and the client needs to re-enter the game, the session needs to be reestablished and a connection between the game service process and the client is established through the session. Further, the disconnection reconnection method further includes: if the session does not exist, establishing a session corresponding to the client; and reestablishing the connection between the first game service process and the client through the newly-established session.
After the connection between the first game service process and the client is reestablished, if the server receives a request sent by the client for connecting the second game service process, the second game service process can be selected, and the connection between the selected second game service process and the client is established.
After the corresponding relationship between the newly-built session and the first connection is established, the game server can manage the first connection through the newly-built session, and then repair or disconnect reconnection is carried out when the first connection fails.
The disconnection reconnection method provided by the embodiment can effectively ensure the communication between the first game service process and the client by newly establishing the session when the session does not exist, thereby ensuring the realization of disconnection reconnection.
In one embodiment, before the disconnection, the method further comprises: and controlling the first game business process to select the second game business process from at least one candidate game business process in a load balancing mode.
The candidate game business process may be a business process with an additional function in the server, and in addition, one function may correspond to at least one game candidate business process.
The load balance of the candidate game business processes can be realized by the first game business process, and the game business processes can be distributed more reasonably as far as possible in a load balancing mode when the load pressure of the game business processes is higher, so that the requests of the client sides are ensured to be responded in time. The implementation process of selecting the second game service process is as follows: when the first game business process receives a copy entering request sent by the client, the load condition of each candidate game business process is determined, and one candidate game business process with low load pressure is selected as a second game business process. On the other hand, there may be more than one second game service process, and therefore, the second game service process may select one of the candidate game service processes with small load pressure as another second game service process according to the incoming combat request of the client. In addition, as the number of the clients connected with the server is often more than one, the clients can be respectively allocated with the second game business process according to the requests of the clients.
In an embodiment, before the step of obtaining the connection address of the second connection if it is determined that the second connection to be restored exists, the method further includes: acquiring a historical connection state; the historical connection state is the connection state between the client and the at least one candidate game service process before disconnection; determining whether the second connection exists according to the historical connection state.
The specific process implemented by this embodiment may be: when the connection already exists, the first connection informs the client of the game state: for example, in a game hall, a room, a copy or a battle, it is determined whether the client has a slave connection according to the game state of the player (for example, if the player is in the copy or the battle, it indicates that the player is already on a certain Battlesvr, the slave connection exists, whereas if the player is in the room, it indicates that the player has not entered the copy or the battle, the slave connection does not exist at this time). When the slave connection exists, acquiring an address corresponding to the slave connection to prompt the client to restore the connection with the second game business process (for example, restoring the game state in the copy); when the slave connection does not exist, the game state of the client in the first game business process can be recovered through the first connection.
In some embodiments, the game player may have established a connection with only the first game service process before the disconnection, and not with the second game service process, at which time the connection address of the second connection does not exist. Therefore, in this embodiment, before acquiring the connection address of the second connection, it is determined whether the second connection exists, if the second connection exists, the connection address of the second connection is acquired through the session, and if the second connection does not exist, the game state of the client may be restored through the first connection without performing the operation of acquiring the connection address.
The disconnection reconnection method for the game provided by the above embodiment obtains the connection address of the slave connection when determining that the slave connection exists, and further prompts the client to recover the slave connection.
In one embodiment, after the step of obtaining the connection address of the second connection, the method further includes: and storing the connection address into a shared memory and/or a database.
For a server with storage, data related to client connection can be stored in persistent storage (e.g., a database) to avoid disconnection reconnection failure caused by loss of server state. For a server without a database, the connection state with the client can be stored in other manners, such as shared memory, so as to prevent the connection state from being asynchronous due to downtime of the server.
In one embodiment, if the server is the server where the game application program is located, the server communicates with a game service process in the server through an internal connection management process; if the server is an external platform, communicating with a game service process in the external platform through an external connection agent process; the external platform is independent of a server on which the game application resides. The game business process in the external platform may also be referred to as an external connection service.
The internal connection management process and the game business process can communicate through a shared memory, and the external connection agent process and the external connection service (including the game business process in the server) can communicate through an inter-process communication pipeline.
Further, in an embodiment, an application scenario of the disconnection reconnection method is shown in fig. 4, where the application scenario includes a client, a connection layer, and a game service layer. The client comprises a mobile device or a PC used by a user. The server side comprises a service layer and a connection layer from top to bottom. The service layer comprises a game service process, and specifically comprises Roomsvr and Battlesvr in the server and external connection service in an external platform; the connection layer manages the connection between the server and the client, and comprises Connd and Relaysvr which are respectively connected with Roomsvr and Battlesvr and Relaysvr which is connected with external connection service. The Connd and the game business process are communicated through Gobus, and the Relaysvr, the Roomsvr, the Battlesvr and the external connection service can be communicated through an inter-process communication pipeline. Communication between Roomsvr and Battlesvr (including with external connection services) is via Gobus or Gobusd.
Further, as shown in fig. 4, Roomsvr may provide the following functions: session management, server message processing, room listing, room management, load balancing management, state synchronization (with battessvr), client message processing; the Battlesvr can manage the copy system and the combat system and can also report the load, so that the Roomsvr selects proper Battlesvr through load balancing (the quantity of the Battlesvr can be more than one); the external connection service may provide the following functions: external connection management, load balancing management, message relay (which may be the relay of messages between Battlesvr and the client), protocol conversion, etc. (which implement the conversion with the protocol in the server). The function provided by the external connection service is similar to Roomsvr, the slave connection between the client and the Battlesvr can be recovered through the main connection between the client and the external connection service, and meanwhile, the external connection service can select a proper Battlesvr in a load balancing mode.
In one embodiment, a disconnection reconnection method is provided, which is applied to a client, and as shown in fig. 5, the method includes:
s501, sending a disconnection reconnection request to a connection management process of a server to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired by the first game business process from the second game business process.
S502, receiving the connection address returned by the connection management process through the first connection.
S503, restoring the second connection through the connection address.
The disconnection reconnection method provided in this embodiment is a disconnection reconnection method implemented from the perspective of a client, and for specific term explanation and implementation methods, reference may be made to the disconnection reconnection method from the perspective of a server. And will not be described in detail herein. According to the disconnection reconnection method, the reconnection states of the client at a plurality of entitlements are synchronized through inter-process communication under the condition that a plurality of connections exist, and the synchronization of player data on different game business processes can be effectively guaranteed.
In one embodiment, after the step of restoring the second connection through the connection address, the method further includes: sending a frame chasing request to the server; the frame tracking request is used for triggering the server to acquire a target data frame from at least one data frame; the at least one data frame is a data frame which meets a preset condition in a game fighting mode of a game application program; receiving the target data frame sent by the server, and calculating the context information of the target data frame; acquiring the state information of the game application program at the current moment from the server; and if the context information is not matched with the state information, continuously sending a frame chasing request to the server, repeating the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovering the game fighting mode.
The game fighting mode may refer to a mode in which characters between players or between a player and a game in a game application are in a fighting state. The game fighting mode is often controlled through an independent process, and at the moment, a plurality of connections exist in the processes of the client and the server, so that when the disconnection occurs, the plurality of connections need to be disconnected and reconnected.
In addition, the game fighting mode often adopts a frame synchronization technology, that is, the server does not participate in a complete logic calculation process, but only stores key data as a relay forwarding node and an arbitration node for synchronizing a plurality of clients. Thus, a data frame is a collection of game combat data, which may also be referred to as a combat frame, and may include player status, player operations, and the like. The data frames meeting the preset conditions can be key frames in the game application program, and can be data frames at certain key moments (for example, the player level changes). The target data frame may contain information about its neighbors.
For the battle of frame synchronization, the client cannot know what the current data frame of the server is, and therefore, the client needs to synchronize with the data frame in the server by frame chase. The peripheral access logic and the fighting logic of the game can be separated, and specifically, the client can send a frame chasing request to a second game service process in the server through a second connection to obtain a corresponding fighting frame, so that the fighting state in the client is recovered. Further, frame synchronization is mainly adopted for the fighting at present, so that only the fighting process can be subjected to frame chasing, and other processes can recover the game state according to a normal method (for example, a current data frame is acquired from a server, and corresponding game information is displayed on an interface of a client according to the data frame so as to recover the game state).
The game application program can generate data frames which are switched continuously according to the interactive operation of the client, so that a dynamic video form is formed, target data frames are data of partial data frames in the game application program, and the client needs to be synchronized with the current data frames in the server when the game state is recovered, so that the client can judge whether the data frames are synchronized with the client only if the data frames corresponding to the target data frames in the client are insufficient, and the data frames in front of or behind the data frames are required to be acquired. Wherein, the data frame at the front or the back moment is the context. Further, the target data frame may include description information of its neighboring data frame, and the specific frame operation algorithm may calculate the context information according to the target frame and the description information.
Further, for the client side frame chase, if the frame synchronization data amount is too large, some battle snapshot modes can be considered to store the periodic battle data, the overhead of disconnection reconnection of the client side is reduced, and the waiting time required by disconnection reconnection is reduced. Furthermore, the combat snapshot directly retains the stage combat details, so that each frame does not need to be chased, for example, one snapshot is provided every 1000 frames, if the frames need to be chased to 5122 frames, 5 snapshots can be obtained from 5000 frames, and then only 122 frames need to be chased from the 5000-frame snapshots, so that the processing mode can greatly shorten the time for the client to restore the game state.
According to the embodiment, in the frame synchronization game bureau, the player synchronizes to the instant context of battle in a mode of chasing frames step by step, and smoothly switches to the current game bureau to continue the game, so that the smoothness of the game application program running at the client side can be effectively improved, and the user experience is improved.
In one embodiment, before the step of sending the frame chase request to the server, the method further includes: sending an initialization request to the server; the initialization request is used for triggering the server to acquire initialization information of the game application program; and carrying out initialization operation according to the initialization information returned by the server.
Specifically, to restore the current battle context, the client needs to request the server for data of all key frames and run the operation of the duplicated key frames. When the client chases frames, the client requests the server for the initial information of battles, such as player information (camp, hero, initial blood volume, etc.) and random seeds, and then chases frames in sequence according to the sequence numbers. Because the data volume of a game is large (more than 5Mb may be possible), a mode of frame-chasing step by step is adopted, each time a request is sent to the server, only partial frames are requested, and after the calculation is finished, the next batch of data frames are requested. And the process is circulated until the state of the server is synchronized. By means of the frame-by-frame mode, the fighting recovery is achieved.
The method for disconnecting and reconnecting the game provided by the embodiment can be suitable for a frame synchronization game framework, provides a technical scheme of gradually chasing frames, enables the client to simulate the whole game process of the repeated game, and enables the server to only store key data frames without completely simulating the whole fighting process.
In one embodiment, a method for disconnection reconnection is provided, as shown in fig. 6, which includes the following steps regardless of the external platform:
s601, the client sends a disconnection reconnection request to a connection management process of the server.
S602, the connection management process determines the session corresponding to the client under the trigger of the disconnection reconnection request, and recovers the first connection between the first game service process and the client according to the session.
S603, the connection management process determines the historical connection between the first game service process and the client before disconnection according to the session, acquires the uplink connection information and the downlink connection information corresponding to the historical connection, migrates the uplink connection information and the downlink connection information into the first connection, and closes the historical connection.
S604, obtaining the historical connection state between the client and the candidate game service process before disconnection, and determining whether a second connection exists according to the historical connection state.
And S605, if the second connection does not exist, recovering the game process corresponding to the first connection in the client according to the first connection.
And S606, if the second connection is determined to exist, the first game service process acquires the connection address of the second connection from the second game service process through the communication channel.
S607, the connection management process returns the connection address to the client through the first connection.
And S608, the client recovers the second connection through the connection address.
And S609, the client sends a frame pursuit request to the server through the second connection, receives the target data frame sent by the server and calculates the context information of the target data frame.
S610, the client acquires the state information of the game application program at the current moment from the server.
S611, if the context information is not matched with the state information, the client continuously sends a frame chasing request to the server, and repeats the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovers the game process corresponding to the game fighting mode.
The application also provides an application scene, and the application scene applies the disconnection reconnection method. The application scenario does not consider an external platform, and as shown in fig. 7, the application of the disconnection reconnection method in the application scenario is as follows:
a) the game client (client for short), Roomsvr and Battlesvr are respectively initialized, and the Roomsvr and Battlesvr monitor the connection request sent by the client in real time (i.e. the disconnection reconnection request in case of disconnection).
b) Session and connection maintenance
The client side initiates a Websocket connection request to Connd, and the Connd brings the long connection into connection management and simultaneously informs a game service process in the server that a new client side connection comes. After receiving the notification of the Connd, the game service process searches for a session corresponding to the main connection (the connection between the client and the Roomsvr). If the session exists, the game service process notifies the Connd, the Connd restores the main connection between the client and the Roomsvr, at the moment, the Connd closes the original old connection, replaces the old connection with the new connection, and migrates the uplink and downlink messages to the new connection; if the session does not exist, a session is newly established and the corresponding relationship between the session and the connection is established (i.e. the client logs in the server again).
c) Multi-connection reconnection and combat chase frame
Roomsvr determines the game state of the client, determines whether the slave connection exists according to the game state, and responds slave connection information to the client.
If a slave connection exists, the slave connection information may include the address of the slave connection. The client acquires the connection address of the slave connection, is connected to the Battlesvr through the connection address, and initiates a frame tracing protocol to the Battlesvr. And repeating the frame tracking process continuously until the client is the same as the server, completing the disconnection reconnection at the moment, and entering a normal game flow.
If there is no slave connection, the slave connection information may be information indicating that there is no slave connection. At this point, the client may enter a normal game flow.
In the whole game process, along with the change of the game state of the player, Roomsvr and Battlesvr can synchronize the connection condition of the player in real time so as to ensure that the states of the players are consistent on different connections. If the inconsistency occurs, the state of the master connection is taken as the arbitration criterion.
The above embodiment is actually tested to simulate various conditions, such as network switching, network disconnection recovery, equipment top number, terminal-killing reconnection and the like. From the test results, it can be found that the disconnection reconnection method provided by the embodiment of the present invention can realize complete disconnection reconnection, so that the client can return to the room again in a short time (within a few seconds at most, the main time is spent on resource loading of the client). For the service logic, various conditions such as a game hall, a game room, a combat replica, actual combat and the like are simulated, meanwhile, simulation tests are carried out on the conditions of existence of subordinate connection, and through tests, the disconnection reconnection method provided by the embodiment of the invention can work normally and efficiently, complete reconnection of the client is realized, the game experience is ensured to be smooth, and the method can be suitable for various game service scenes. The method has the advantages of reliability, high efficiency, expandability and portability, and can be applied to solving the disconnection reconnection problem of various game servers.
In addition, the long TCP connection is mainly adopted in the traditional technology, the game server adopts C + + or other programming languages, and the long TCP connection cannot be well transplanted to the game server which is developed based on Golang and establishes connection through a Websocket protocol, and the disconnection reconnection method provided by the embodiment of the invention can be well applied to the scene.
It should be understood that although the various steps in the flowchart of fig. 3/5/6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 3/5/6 may include multiple steps or phases that are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the steps or phases is not necessarily sequential, but may be alternated or performed with other steps or at least some of the other steps or phases.
Based on the same idea as the disconnection reconnection method in the above embodiment, the present invention also provides a disconnection reconnection apparatus, which can be used to perform the disconnection reconnection method. For convenience of illustration, only the parts related to the embodiments of the present invention are shown in the schematic structural diagram of the embodiments of the disconnection reconnecting device, and those skilled in the art will understand that the illustrated structure does not constitute a limitation of the device, and may include more or less components than those illustrated, or combine some components, or arrange different components.
In one embodiment, as shown in fig. 8, there is provided a disconnection reconnection device 800, applied to a server, where the device may adopt a software module or a hardware module, or a combination of the two modules as a part of a computer apparatus, and the device specifically includes: a session determining module 801, a first connection recovering module 802, a connection address obtaining module 803, and a second connection recovering module 804, wherein:
a session determining module 801, configured to determine a session corresponding to a client when receiving a disconnection reconnection request sent by the client through a connection management process.
A first connection recovery module 802, configured to recover a first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process.
A connection address obtaining module 803, configured to obtain a connection address of a second connection to be restored if it is determined that the second connection exists; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process.
A second connection recovery module 804, configured to trigger the connection management process to return the connection address to the client through the first connection, so as to recover the second connection.
In the disconnection reconnection device provided in the above embodiment, when a disconnection occurs, the client sends a disconnection reconnection request to the connection management process, the first connection between the first game service process and the client is restored through the connection management process, and the connection address between the second game service process and the client is returned to the client through the first connection, so as to restore the second connection between the second game service process and the client. Under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through interprocess communication, so that the synchronization of player data on different game business processes can be effectively ensured.
In one embodiment, the connection address obtaining module is further configured to obtain the connection address obtained by the first game service process from the second game service process through a communication channel; the communication channel includes at least one of a shared memory and a remote process communication agent.
In one embodiment, the apparatus further comprises: a historical connection determining module, configured to determine, according to the session, a historical connection corresponding to the client; the historical connection is the connection between the first game business process and the client before disconnection; a connection information obtaining module, configured to obtain uplink connection information and downlink connection information corresponding to the historical connection; a connection information migration module, configured to migrate the uplink connection information and the downlink connection information to the first connection; and the connection closing module is used for triggering the connection management process to close the historical connection.
In one embodiment, the apparatus further comprises: the session establishing module is used for establishing a session corresponding to the client if the session does not exist; and the connection reestablishment module is used for reestablishing the connection between the first game service process and the client through the newly-established session.
In one embodiment, the apparatus further comprises: and the service process selection module is used for controlling the first game service process to select the second game service process from at least one candidate game service process in a load balancing mode before disconnection.
In one embodiment, the apparatus further comprises: the connection state acquisition module is used for acquiring a historical connection state; the historical connection state is the connection state between the client and the at least one candidate game service process before disconnection; and the connection judging module is used for determining whether the second connection exists according to the historical connection state.
In one embodiment, the apparatus further comprises: the heartbeat time updating module is used for updating the heartbeat time of the corresponding session according to the heartbeat packet if the heartbeat packet sent by the client is received; the heartbeat packet is sent by the client regularly; the session and state processing module is used for recovering the corresponding session and setting the corresponding game account to be in an off-line state if the heartbeat packet sent by the client is not received within a set time period; the game account is an account registered in the server by the client.
In one embodiment, as shown in fig. 9, a disconnection reconnecting apparatus 900 is provided, which is applied to a client and can be a part of a computer device by using a software module or a hardware module, or a combination of the two modules, and specifically includes: a reconnection request sending module 901, a connection address receiving module 902 and a connection recovering module 903, wherein:
a reconnection request sending module 901, configured to send a disconnection reconnection request to a connection management process of a server, so as to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired by the first game business process from the second game business process.
A connection address receiving module 902, configured to receive the connection address returned by the connection management process through the first connection.
A connection restoring module 903, configured to restore the second connection through the connection address.
In the disconnection reconnection device provided in the above embodiment, when a disconnection occurs, the client sends a disconnection reconnection request to the connection management process, the first connection between the first game service process and the client is restored through the connection management process, and the connection address between the second game service process and the client is returned to the client through the first connection, so as to restore the second connection between the second game service process and the client. Under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through interprocess communication, so that the synchronization of player data on different game business processes can be effectively ensured.
In one embodiment, the apparatus further comprises: the frame tracking request sending module is used for sending a frame tracking request to the server; the frame tracking request is used for triggering the server to acquire a target data frame from at least one data frame; the at least one data frame is a data frame which meets a preset condition in a game fighting mode of a game application program; the context calculation module is used for receiving the target data frame sent by the server and calculating the context information of the target data frame; the state information acquisition module is used for acquiring the state information of the game application program at the current moment from the server; and the frame tracking repeating module is used for continuously sending a frame tracking request to the server side if the context information is not matched with the state information, repeating the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovering the game fighting mode.
In one embodiment, the apparatus further comprises: an initialization request sending module, configured to send an initialization request to the server; the initialization request is used for triggering the server to acquire initialization information of the game application program; and the initialization module is used for carrying out initialization operation according to the initialization information returned by the server.
In one embodiment, if the server is the server where the game application program is located, the server communicates with a game service process in the server through an internal connection management process; if the server is an external platform, communicating with a game service process in the external platform through an external connection agent process; the external platform is independent of a server on which the game application resides.
For the specific definition of the disconnection reconnection device, reference may be made to the above definition of the disconnection reconnection method, which is not described herein again. The modules in the disconnection reconnection device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, there is provided a disconnection reconnecting system, as shown in fig. 10, including: a server 1010 and a client 1020; the server comprises a first game service process 1011, a second game service process 1012 and a connection management process 1013; the client is used for sending a disconnection reconnection request to a connection management process of the server; the connection management process is used for determining a session corresponding to the client and recovering a first connection according to the session; the first connection is formed by the first game business process and the client through the connection management process; the first game business process is used for acquiring a connection address of a second connection from the second game business process if the second connection to be recovered is determined to exist; the second connection is a connection between the second game business process and the client; the connection management process is further configured to return the connection address to the client through the first connection; the client is further used for recovering the second connection through the connection address.
In the disconnection reconnection system provided in the above embodiment, when a disconnection occurs, the client sends a disconnection reconnection request to the connection management process, the connection management process restores the first connection between the first game service process and the client, returns the connection address between the second game service process and the client to the client through the first connection, and the client restores the second connection between the second game service process and the client according to the connection address. Under the condition that a plurality of connections exist, the reconnection states of the client at a plurality of entitlements are synchronized through interprocess communication, so that the synchronization of player data on different game business processes can be effectively ensured.
In one embodiment, a computer device is provided, and the computer device may be a server, and specifically, may be a server in the foregoing embodiments, and its internal structure diagram may be as shown in fig. 11. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data such as connection addresses. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a disconnect reconnect method.
In one embodiment, a computer device is provided, and the computer device may be a terminal, specifically, a client in the foregoing embodiments, and its internal structure diagram may be as shown in fig. 12. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a disconnect reconnect method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the configurations shown in fig. 11 and 12 are block diagrams of only some of the configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (24)

1. A disconnection reconnection method is applied to a server side and comprises the following steps:
when a disconnection reconnection request sent by a client through a connection management process is received, determining a session corresponding to the client;
restoring the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process;
if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process;
and triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
2. The method of claim 1, wherein the step of obtaining the connection address of the second connection comprises:
acquiring the connection address acquired by the first game service process from the second game service process through a communication channel; the communication channel includes at least one of a shared memory and a remote process communication agent.
3. The method of claim 2, further comprising, after the step of resuming the first connection according to the session:
determining historical connection corresponding to the client according to the session; the historical connection is the connection between the first game business process and the client before disconnection;
acquiring uplink connection information and downlink connection information corresponding to the historical connection;
migrating the uplink connection information and the downlink connection information to the first connection;
and triggering the connection management process to close the historical connection.
4. The method of claim 2, further comprising:
if the session does not exist, establishing a session corresponding to the client;
and reestablishing the connection between the first game service process and the client through the newly-established session.
5. The method of claim 2, wherein prior to the wire break, the method further comprises:
and controlling the first game business process to select the second game business process from at least one candidate game business process in a load balancing mode.
6. The method according to claim 5, wherein before the step of obtaining the connection address of the second connection if it is determined that there is a second connection to be restored, further comprising:
acquiring a historical connection state; the historical connection state is the connection state between the client and the at least one candidate game service process before disconnection;
determining whether the second connection exists according to the historical connection state.
7. The method of any of claims 1 to 6, further comprising:
if a heartbeat packet sent by the client is received, updating the heartbeat time of the corresponding session according to the heartbeat packet; the heartbeat packet is sent by the client regularly;
if the heartbeat packet sent by the client is not received within a set time period, recovering the corresponding session, and setting the corresponding game account to be in an offline state; the game account is an account registered in the server by the client.
8. A disconnection reconnection method is applied to a client, and comprises the following steps:
sending a disconnection reconnection request to a connection management process of a server to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired from the second game business process by the first game business process;
receiving the connection address returned by the connection management process through the first connection;
restoring the second connection through the connection address.
9. The method of claim 8, further comprising, after the step of restoring the second connection via the connection address:
sending a frame chasing request to the server; the frame tracking request is used for triggering the server to acquire at least one data frame as a target data frame; the at least one data frame is a data frame which meets a preset condition in a game fighting mode of a game application program; the data frame meeting the preset condition is a key frame in a game application program;
receiving the target data frame sent by the server, and calculating the context information of the target data frame;
acquiring the state information of the game application program at the current moment from the server;
and if the context information is not matched with the state information, continuously sending a frame chasing request to the server, repeating the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovering the game fighting mode.
10. The method of claim 9, wherein the step of sending the frame chase request to the server is preceded by:
sending an initialization request to the server; the initialization request is used for triggering the server to acquire initialization information of the game application program;
and carrying out initialization operation according to the initialization information returned by the server.
11. The method according to claim 9 or 10,
if the server side is the server where the game application program is located, communicating with a game service process in the server through an internal connection management process;
if the server is an external platform, communicating with a game service process in the external platform through an external connection agent process; the external platform is independent of a server on which the game application resides.
12. A disconnection reconnection device, applied to a server, comprises:
the session determining module is used for determining a session corresponding to a client when a disconnection reconnection request sent by the client through a connection management process is received;
the first connection recovery module is used for recovering the first connection according to the session; the first connection is formed by a first game business process in the server and the client through the connection management process;
the connection address acquisition module is used for acquiring a connection address of a second connection to be recovered if the second connection is determined to exist; the second connection is the connection between a second game service process in the server and the client, and the connection address is obtained by the first game service process from the second game service process;
and the second connection recovery module is used for triggering the connection management process to return the connection address to the client through the first connection so as to recover the second connection.
13. The apparatus according to claim 12, wherein the connection address obtaining module is further configured to obtain the connection address obtained by the first game service process from the second game service process through a communication channel; the communication channel includes at least one of a shared memory and a remote process communication agent.
14. The apparatus of claim 13, further comprising:
a historical connection determining module, configured to determine, according to the session, a historical connection corresponding to the client; the historical connection is the connection between the first game business process and the client before disconnection;
a connection information obtaining module, configured to obtain uplink connection information and downlink connection information corresponding to the historical connection;
a connection information migration module, configured to migrate the uplink connection information and the downlink connection information to the first connection;
and the connection closing module is used for triggering the connection management process to close the historical connection.
15. The apparatus of claim 13, further comprising:
the session establishing module is used for establishing a session corresponding to the client if the session does not exist;
and the connection reestablishment module is used for reestablishing the connection between the first game service process and the client through the newly-established session.
16. The apparatus of claim 13, further comprising: and the service process selection module is used for controlling the first game service process to select the second game service process from at least one candidate game service process in a load balancing mode before disconnection.
17. The apparatus of claim 16, further comprising:
the connection state acquisition module is used for acquiring a historical connection state; the historical connection state is the connection state between the client and the at least one candidate game service process before disconnection;
and the connection judging module is used for determining whether the second connection exists according to the historical connection state.
18. The apparatus of any one of claims 12 to 17, further comprising:
the heartbeat time updating module is used for updating the heartbeat time of the corresponding session according to the heartbeat packet if the heartbeat packet sent by the client is received; the heartbeat packet is sent by the client regularly;
the session and state processing module is used for recovering the corresponding session and setting the corresponding game account to be in an off-line state if the heartbeat packet sent by the client is not received within a set time period; the game account is an account registered in the server by the client.
19. An apparatus for reconnecting a disconnected cable, applied to a client, the apparatus comprising:
the reconnection request sending module is used for sending a disconnection reconnection request to a connection management process of a server so as to trigger the server to determine a corresponding session; restoring the first connection according to the session; the first connection is formed by a first game business process in the server and a client through the connection management process; if the second connection to be recovered exists, acquiring a connection address of the second connection; the second connection is the connection between a second game business process in the server and the client, and the connection address is acquired from the second game business process by the first game business process;
a connection address receiving module, configured to receive the connection address returned by the connection management process through the first connection;
and the connection recovery module is used for recovering the second connection through the connection address.
20. The apparatus of claim 19, further comprising:
the frame tracking request sending module is used for sending a frame tracking request to the server; the frame tracking request is used for triggering the server to acquire at least one data frame as a target data frame; the at least one data frame is a data frame which meets a preset condition in a game fighting mode of a game application program; the data frame meeting the preset condition is a key frame in a game application program;
the context calculation module is used for receiving the target data frame sent by the server and calculating the context information of the target data frame;
the state information acquisition module is used for acquiring the state information of the game application program at the current moment from the server;
and the frame tracking repeating module is used for continuously sending a frame tracking request to the server side if the context information is not matched with the state information, repeating the steps of calculating the context information and acquiring the state information until the context information is matched with the state information, and recovering the game fighting mode.
21. The apparatus of claim 20, further comprising:
an initialization request sending module, configured to send an initialization request to the server; the initialization request is used for triggering the server to acquire initialization information of the game application program;
and the initialization module is used for carrying out initialization operation according to the initialization information returned by the server.
22. The apparatus according to claim 20 or 21, wherein if the server is a server where the game application program is located, the server communicates with a game service process in the server through an internal connection management process; if the server is an external platform, communicating with a game service process in the external platform through an external connection agent process; the external platform is independent of a server on which the game application resides.
23. A system for disconnection and reconnection, said system comprising: a server and a client; the server comprises a first game service process, a second game service process and a connection management process;
the client is used for sending a disconnection reconnection request to a connection management process of the server;
the connection management process is used for determining a session corresponding to the client and recovering a first connection according to the session; the first connection is formed by the first game business process and the client through the connection management process;
the first game business process is used for acquiring a connection address of a second connection from the second game business process if the second connection to be recovered is determined to exist; the second connection is a connection between the second game business process and the client;
the connection management process is further configured to return the connection address to the client through the first connection;
the client is further used for recovering the second connection through the connection address.
24. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 11 when executing the computer program.
CN202010175673.6A 2020-03-13 2020-03-13 Disconnection reconnection method, device and system and computer equipment Active CN111416849B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010175673.6A CN111416849B (en) 2020-03-13 2020-03-13 Disconnection reconnection method, device and system and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010175673.6A CN111416849B (en) 2020-03-13 2020-03-13 Disconnection reconnection method, device and system and computer equipment

Publications (2)

Publication Number Publication Date
CN111416849A CN111416849A (en) 2020-07-14
CN111416849B true CN111416849B (en) 2021-07-13

Family

ID=71492961

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010175673.6A Active CN111416849B (en) 2020-03-13 2020-03-13 Disconnection reconnection method, device and system and computer equipment

Country Status (1)

Country Link
CN (1) CN111416849B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113521727A (en) * 2021-07-22 2021-10-22 网易(杭州)网络有限公司 Game reconnection method, device, equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150149524A1 (en) * 2013-11-27 2015-05-28 Sharp Kabushiki Kaisha Network system, constant connection method, electronic device, server, and program
CN104270339A (en) * 2014-09-01 2015-01-07 腾讯科技(深圳)有限公司 Reconnection method, equipment and system for TCP (Transmission Control Protocol) connection
CN105677451A (en) * 2014-11-18 2016-06-15 北京风行在线技术有限公司 Load balancing method and equipment used for multiple processes
CN104935634B (en) * 2015-04-27 2018-03-30 南京大学 Mobile device data sharing method based on Distributed shared memory
US20170156083A1 (en) * 2015-11-30 2017-06-01 Zynga Inc. Maintaining persistent mobile device session
CN105635116B (en) * 2015-12-18 2019-02-12 网易(杭州)网络有限公司 Disconnection reconnecting method, apparatus and system
CN105653386B (en) * 2015-12-30 2018-09-21 广东欧珀移动通信有限公司 A kind of process collapse processing method and terminal device
CN108540450B (en) * 2018-03-12 2021-03-23 网易(杭州)网络有限公司 Data transmitting and receiving method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"a novel session recovery mechanism for cluster-based signaling architecture for conferencing in manets";Chunyan Fu;《IEEE》;20070630;全文 *

Also Published As

Publication number Publication date
CN111416849A (en) 2020-07-14

Similar Documents

Publication Publication Date Title
CN106899518B (en) Resource processing method and device based on Internet data center
US10140112B2 (en) Update management system and update management method
US9992058B2 (en) Redundant storage solution
WO2023046088A1 (en) End-to-end system solution method applied to audio and video data transmission
CN109525627B (en) Data transmission method, data transmission device, storage medium and electronic device
CN112804213B (en) Communication disconnection reconnection method, device, system, readable medium and electronic equipment
WO2017176453A1 (en) Method for optimal vm selection for multi data center virtual network function deployment
CN111416849B (en) Disconnection reconnection method, device and system and computer equipment
WO2017215408A1 (en) Session switching control method and apparatus and access point device
CN112612769A (en) File processing method, device and storage medium
CN112121413A (en) Response method, system, device, terminal and medium of function service
CN111880929A (en) Instance management method and device and computer equipment
CN110351122B (en) Disaster recovery method, device, system and electronic equipment
CN109714328B (en) Capacity adjustment method and device for game cluster
CN116193481A (en) 5G core network processing method, device, equipment and medium
CN111541608A (en) Network communication method, system and related device
CN113596197B (en) Address switching method and device, electronic equipment and storage medium
US11650892B1 (en) Resilient coordination, command, and control of widely distributed test agents
CN104702693A (en) Processing method for two-node system partitioning and node
CN105978746B (en) Game server group system and raising gamespace method of servicing
CN111966469B (en) Cluster virtual machine high availability method and system
CN101072233B (en) Method and system for stimulating stateful connection based on stateless network protocol
CN113949631A (en) Client disaster tolerance processing method and system and electronic equipment
CN112506729B (en) Fault simulation method and device
CN111414411B (en) High availability database system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40025605

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant