CN116382930A - Method, device and medium for session control synchronization - Google Patents

Method, device and medium for session control synchronization Download PDF

Info

Publication number
CN116382930A
CN116382930A CN202310418685.0A CN202310418685A CN116382930A CN 116382930 A CN116382930 A CN 116382930A CN 202310418685 A CN202310418685 A CN 202310418685A CN 116382930 A CN116382930 A CN 116382930A
Authority
CN
China
Prior art keywords
session
session control
synchronization
information
data block
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.)
Pending
Application number
CN202310418685.0A
Other languages
Chinese (zh)
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.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data Technology 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 Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN202310418685.0A priority Critical patent/CN116382930A/en
Publication of CN116382930A publication Critical patent/CN116382930A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a device and a medium for session control synchronization, which are suitable for the technical field of computers. Comprising the following steps: acquiring a plurality of sessions and corresponding data block structures; performing corresponding locking processing on the information of the plurality of session in the data block structure body to create respective lock files; and when the synchronization of the session is completed, unlocking the lock file corresponding to the synchronized session. When locking processing is carried out in the session synchronization flow, respective corresponding lock files are created for a plurality of sessions, different session syncs have different lock files, the respective session synchronization flow is not affected, even if the lock file of the current session is not released in time, the locking processing of the next session syncs is not affected, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.

Description

Method, device and medium for session control synchronization
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a session synchronization method, apparatus, and medium.
Background
The internet small computer system interface (Internet Small Computer System Interface, iSCSI) is a typical client server architecture, where the computer accessing the storage system becomes the client, the software responsible for the connection becomes the initiator, the computer providing the storage service becomes the server, and the software becomes the target.
When the iscsi client service iscsi state is closed or is restarted, a lock operation of lun is performed by using an ischiadm command at this time, session not found failure may occur, which is caused by that the session is not completed synchronously, the lock file is not released, and since a plurality of sessions share one lock file, when the lock file is not released, other subsequent sessions cannot be locked synchronously, so that the working efficiency of software is reduced.
Therefore, how to improve the working efficiency of the software and avoid the failure of locking and unlocking, which results in that other session cannot be synchronized, is needed to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a method, a device and a medium for session control synchronization, wherein different session synchronization has different lock files, each does not affect the respective session synchronization flow, and even if the lock file of the current session is not released in time, the lock processing is not affected when the next session is synchronized, so that the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
In order to solve the above technical problems, the present invention provides a method for session control synchronization, including:
acquiring a plurality of session controls and corresponding data block structures, wherein the data block structures store a plurality of session control information;
performing corresponding locking processing on a plurality of session control information in the data block structure body to create respective lock files;
and when the session control is synchronous, unlocking the lock file corresponding to the synchronous session control.
Preferably, acquiring the data block structure of the session control includes:
reading information of the info structure body of the session control;
checking the information of the info structure body to determine that the information of the session control is legal data;
storing the legal data in the data block structure.
Preferably, said performing a corresponding locking process on a plurality of said session control information within said data block structure to create respective lock files comprises:
corresponding session control IDs are created for the information of a plurality of session controls, wherein the session control IDs are the same as the number of the session controls.
Preferably, the session control synchronization process includes:
acquiring the session control ID through the info structure;
determining the transmission protocol type of the session control according to the session control ID;
acquiring current host number information according to the transmission protocol type of the session control;
and determining session control created by a user according to the host number information so as to synchronize the session control.
Preferably, before the session control synchronization, the method further comprises:
when the iscoid service is started, a synchronous process of the session control synchronization is established;
determining an interface function of the session control synchronization;
scanning a session control directory through the interface function;
adding the scanned session control catalogue into a linked list;
traversing the linked list to read the information of the session control directory and store the information into the info structure body.
Preferably, the determining the session control created by the user according to the host number information includes:
judging whether the host number is session control created by the user;
if yes, synchronizing the session control established by the user;
if not, determining the session control created for the kernel, and returning to the process of acquiring the current host number information according to the transmission protocol type of the session control to acquire the next host number information.
Preferably, after the unlocking process is performed on the lock file corresponding to the session control after the synchronization is completed, the method further includes:
deleting the lock file after unlocking and outputting log information.
In order to solve the above technical problem, the present invention further provides a device for session control synchronization, including:
the system comprises an acquisition module, a data block storage module and a data block storage module, wherein the acquisition module is used for acquiring a plurality of session controls and corresponding data block structures, and the data block structures store a plurality of session control information;
the locking processing module is used for carrying out corresponding locking processing on the information of the session control in the data block structure body so as to create respective lock files;
and the unlocking processing module is used for unlocking the lock file corresponding to the session control after the session control is synchronized.
Preferably, the acquiring module includes:
the reading module is used for reading the information of the info structure body of the session control;
the first determining module is used for checking the information of the info structure body to determine that the information of the session control is legal data;
and the storage module is used for storing the legal data in the data block structure body.
Preferably, the locking processing module includes:
and the creation module is used for creating corresponding session control IDs for the information of a plurality of session controls, wherein the session control IDs are the same as the session controls in number.
Preferably, the synchronization module in the unlocking processing module includes:
a first acquisition module, configured to acquire the session control ID through the info structure;
a second determining module, configured to determine a transport protocol type of the session control according to the session control ID;
the second acquisition module is used for acquiring current host number information according to the transmission protocol type of the session control;
and the third determining module is used for determining session control created by a user according to the host number information so as to carry out the session control synchronization.
Preferably, the method further comprises:
the starting module is used for creating a synchronous process of the session control synchronization when the iscsid service is started;
a fourth determining module, configured to determine an interface function of the session control synchronization;
the scanning module is used for scanning the session control catalogue through the interface function;
the adding module is used for adding the scanned session control catalogue into a linked list;
And the traversing module is used for traversing the linked list to read the information of the session control directory and store the information into the info structure body.
Preferably, the third determining module includes:
the judging module is used for judging whether the host number is session control created by the user, if so, entering the synchronizing module, and if not, entering the fourth determining module;
the synchronization module is used for synchronizing the session control established by the user;
and the SPASYL fourth determining module is used for determining the session control created for the kernel, and returning to the process of acquiring the current host number information according to the transmission protocol type of the session control so as to acquire the next host number information.
Preferably, the method further comprises:
and the output module is used for deleting the lock file after the unlocking processing and outputting log information.
In order to solve the above technical problem, the present invention further provides a device for session control synchronization, including:
a memory for storing a computer program;
a processor for performing the steps of the method of session control synchronization as described above when executing the computer program.
To solve the above technical problem, the present invention further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method for session control synchronization as described above.
The invention provides a method for synchronizing session control, which comprises the following steps: acquiring a plurality of session controls and corresponding data block structures, wherein the data block structures store information of the plurality of session controls; performing corresponding locking processing on the information of the plurality of session controls in the data block structure body to create respective lock files; and when the session control is synchronous, unlocking the lock file corresponding to the synchronous session control. When locking processing is carried out in a session control synchronization flow, the method creates respective corresponding lock files for a plurality of sessions, different session syncs have different lock files, each does not affect the respective session synchronization flow, and even if the lock file of the current session is not released in time, the locking processing is not affected when the next session is synchronized, so that the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
In addition, the invention also provides a device and a medium for session control synchronization, which have the same beneficial effects as the method for session control synchronization.
Drawings
For a clearer description of embodiments of the present invention, the drawings that are required to be used in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
Fig. 1 is a flowchart of a method for session control synchronization according to an embodiment of the present invention;
fig. 2 is a block diagram of a device for session control synchronization according to an embodiment of the present invention;
fig. 3 is a block diagram of another apparatus for session control synchronization according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without making any inventive effort are within the scope of the present invention.
The core of the invention is to provide a method, a device and a medium for session control synchronization, wherein different session synchronization has different lock files, each does not affect the respective session synchronization flow, and even if the lock file of the current session is not released in time, the lock processing is not affected when the next session is synchronized, so that the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
In order to better understand the aspects of the present invention, the present invention will be described in further detail with reference to the accompanying drawings and detailed description.
Note that iSCSI (Internet SCSI) is a standard set by the internet engineering task force (The Internet Engineering Task Force, IETF) for mapping SCSI data blocks into ethernet data packets. The iSCSI protocol packages SCSI data blocks into transmission control protocol/internet protocol (Transmission Control Protocol/Internet Protocol, TCP/IP) packets for transmission within existing networks. In an internet protocol address (Internet Protocol Address, IP) storage area network (Storage Area Network, SAN) networking, interfacing between hosts and storage needs to be accomplished using iSCSI protocols. In Windows Server 2003, the interface between the Windows system and the IP SAN storage device is realized by using iSCSI Initiator software, while in Linux system, the interface between the Linux host and the IP SAN storage device is realized by using a modified configuration file or OpeniSCSI. The network file system (Network File System, NFS) protocols of iSCSI and SUN are solutions to solve the problem of storage resource sharing. The two are intended to be identical, except that the two are different implementations, the former being presented on the client as a block device and the latter as a directory tree. iSCSI is a storage device remote mapping technique that maps storage devices on a remote server to local and presents them as a block device (which may be understood as a disk). From the perspective of the average user, the mapped disk is not different from the locally installed disk. This mapping is based on the SCSI protocol, which is the protocol by which a computer communicates with peripheral devices (e.g., hard disk, optical disk, etc.). iSCSI is a protocol that encapsulates SCSI via TCP, i.e., transfers the contents of the SCSI protocol via ethernet.
Because iSCSI is based on the TCP protocol, the initiator and target may be implemented in pure software or in hardware. In the case of a hardware implementation, the hardware implementation mainly encapsulates and parses SCSI commands, etc., so that the central processing unit (Central Processing Unit, CPU) resources can be released. Under Linux, the starter and the target are all implemented by pure software, and the starter open-iscsi is used in the invention. open-iSCSI is a high performance initiator program that implements the RFC3720 iSCSI protocol. iSCSI makes access to storage on SAN no longer dependent on Fibre channels, but also over TCP protocols and ethernet networks. With it, remote block devices can be directly connected to Linux just as conveniently as local block devices. Current open-iscsi comprises two parts: the kernel part realizes the sc read/write function, and the user space mainly completes configuration management, automatic discovery of iSCSI target, login, logout, error processing, connection maintenance and the like. The user manages the connection of the initiator terminal and the target terminal through ischiadm.
Based on the existing method for synchronizing session control, when the logo operation is performed, the service is not started, the service is automatically triggered to start, when the iscsid service is started, the synchronization operation of the session is performed, a lock file lock. If a plurality of luns are mounted on the client, and the logo is carried out after the service is abnormal, a plurality of session is synchronized at the moment, the lock failure of other session can be caused by untimely deletion of a lock file lock. And introducing an optimization method of a session synchronization function, and optimizing and changing the lock file to avoid the problem of locking and unlocking failure.
Fig. 1 is a flowchart of a method for session control synchronization according to an embodiment of the present invention, as shown in fig. 1, where the method includes:
s11: acquiring a plurality of session controls and corresponding data block structures, wherein the data block structures store information of the plurality of session controls;
s12: performing corresponding locking processing on the information of the plurality of session controls in the data block structure body to create respective lock files;
s13: and when the session control is synchronous, unlocking the lock file corresponding to the synchronous session control.
Specifically, a plurality of session controls (sessions) and corresponding data block structures are acquired, wherein the data block structures are db structures, and specific user data accessible by all blocks is contained in a data block in one program. Each FB, FC, or OB is capable of reading and writing these Data blocks, which are accessible by the logical blocks of all S7 programs. Each FB, FC, or OB reads or writes data contained in these data blocks. Data blocks (instance data blocks) assigned to one FB (Data blocks assigned to an FB (instance DB)).
An instance data block is a data block assigned to a particular functional block. Their function blocks' specified local data. These data blocks are automatically established by the S7-SCL compiler when the FB is invoked by the user program. DB is a database handle representing a connection pool with zero to multiple underlying connections. The data block structure stores messages for a plurality of sessions.
Session is meant to refer to a series of actions/messages that have always been, such as: a series of processes from picking up a call to hanging up a call when making a call may be referred to as a session. It may be seen that this is the case when reading a technical book, which is "during a browser session …", the term session being used herein in its sense to refer to the entire period from opening to closing of a browser window. Most confusing is that a sentence "user (client) is during a session" may refer to a series of actions by the user (typically a series of actions related to a specific purpose, such as a process of shopping online from logging in to a selected item to checkout, sometimes also referred to as a transaction), but may also refer to a connection at times.
However, when the session is associated with a network protocol, both meanings of "connection-oriented" and/or "keep-state" are often implied. "connection-oriented" refers to a channel that a communication party needs to establish before communication, such as making a call, and cannot start until the communication party receives the call, and is opposite to writing a letter, you cannot confirm whether the address of the other party is correct when you send the letter, and the communication channel cannot be established, but the communication is started for the sender. By "hold state" is meant that the communicating party is able to associate a series of messages such that the messages are interdependent, e.g. a attendant is able to recognize a new old customer and remember that the customer was owed to a money in the store last time. Examples of this class are "a TCP session" or "a POP3 session".
Corresponding locking processes are performed on the plurality of session messages within the data block structure in step S12 to create respective lock files. session is the only identification information that remains in communication with the server side throughout the operation of a single operator. Among multiple requests by the same operator, the session always guarantees to be the same object, not multiple objects, as it can be locked. When multiple requests of the same operator enter, the one-way passage can be limited by the session. By using session and adding token in session, it is verified whether the same operator makes concurrent repeated request, when the latter request comes, token in session is used to verify whether token in request is consistent, when it is inconsistent, it is considered as repeated submission, and pass will not be permitted.
The whole flow can be expressed by the following flow:
1. the client applies for a token;
2. the server generates a token and stores the token in a session, and simultaneously sends the token to the client;
3. the client stores the token and simultaneously sends token information when the request is submitted;
4. the server end uniformly intercepts all requests of the user, and verifies whether the current request needs to be verified (not all requests are verified and repeatedly submitted);
5. Verifying whether the token in the session is consistent with the token in the user request, and releasing if so;
6. session clears the token in the session, and prepares for the next token generation;
7. concurrent repeat requests arrive, verifying that the token and the request token are inconsistent, and the request is denied.
As one embodiment, performing corresponding locking processing on information of multiple sessions within a data block structure to create respective lock files includes:
corresponding session IDs are created for the information of the plurality of sessions, wherein the session IDs are the same as the number of sessions.
It will be appreciated that the locking process is performed on information from multiple sessions within the data block structure to create a lock file lock. The number of the corresponding lock files and the session is the same, and the specific locking process is to add the session ID.
When a User logs in an identity, a User name and a password are input in a browser to log in, and the server is programmed to pass through session_start (); enabling a session, automatically calling session_regenerate_id (); and generating and recording the information such as session id, timestamp and the like. This session id, like a temporary identification card (which typically sets an expiration time), is returned to the browser via a cookie and is automatically carried on the browser's next visit. If there was a Session id before, the Session will check if it has expired, it will regenerate a Session id for the accessing user, and if it has not expired, it will update other automatically maintained information.
And when the session synchronization is completed, unlocking the lock file corresponding to the synchronized session so as to facilitate the content in the data block structure to be used by other session synchronization processes.
The method for synchronizing session control provided by the embodiment of the invention comprises the following steps: acquiring a plurality of session and a corresponding data block structure body, wherein the data block structure body stores information of the plurality of session; performing corresponding locking processing on the information of the plurality of session in the data block structure body to create respective lock files; and when the synchronization of the session is completed, unlocking the lock file corresponding to the synchronized session. When locking processing is carried out in session synchronization flow, the method creates respective corresponding lock files for a plurality of sessions, different session synchronization has different lock files, each does not affect the respective session synchronization flow, even if the lock file of the current session is not released in time, the locking processing is not affected when the next session is synchronized, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
On the basis of the above embodiment, the data block structure for acquiring session in step S11 includes:
reading information of a structure (info) of the session;
checking the information of the info structure body to determine that the information of the session is legal data;
legal data is stored within the data block structure.
Specifically, the session () method is called, and the method returns a session structure body, where the structure body is defined as follows, name in the structure body is the name of the session, and value is user-defined information in the form of a key value pair stored in a server corresponding to the session-name. Information data of a structure body (info) is read, verification processing is carried out on the information data to determine the legality and the completeness of the current information data, and the information data is stored in the data block structure body after verification processing so as to facilitate subsequent session synchronization.
On the basis of the above embodiment, as an embodiment, the synchronization process of session includes:
acquiring a session ID through the info structure;
determining the transmission protocol type of the session according to the session ID;
acquiring current host number information according to the transmission protocol type of session;
and determining the session created by the user according to the host number information to perform session synchronization.
Specifically, the session ID is acquired through the info structure, the transmission protocol type is determined according to the session ID, the host node (host node) information is determined according to the transmission protocol type, and whether the session is created by the user or the session created by the kernel is determined according to the host node information.
When a program needs to create a session for a request of a client, the server first checks whether the request of the client already contains a session identifier, called a session id, if a session id is already contained, then the server retrieves the session for use according to the session id (if not, a new session may be created), if the client request does not contain a session id, then a session is created for the client and a session id associated with the session is generated, the value of the session id should be a unique value that cannot be repeated, and is saved in a Map-like collection, and the session id is returned to the client for saving in the response.
The session id can be stored in a cookie way, so that the browser can automatically exert the identifier to the server according to rules during interaction, and the cookie is generally similar to the session id in name.
As one embodiment, determining a user-created session according to host number information includes:
judging whether the host number is a session created by a user;
if yes, performing session synchronization on the session created by the user;
if not, determining the session created for the kernel, and returning to the process of acquiring the current host number information according to the transmission protocol type of the session to acquire the next host number information.
Specifically, whether the host number is a session created by the user is determined, and it can be understood that session synchronization provided by the embodiment of the present invention is performed for the session created by the user. The session not found error problem described above does not occur with respect to kernel-created session synchronization, so only user-created sessions are synchronized.
In addition, for the session mechanism, unless the program notifies the server to delete a session, the server remains, and the program typically instructs to delete a session when the user makes log off. However, the browser never actively notifies the server that he will be closed before closing, so the server has no opportunity to know that the browser is closed at all, and there is an illusion that most session mechanisms use session cookies to save the session id, the session id disappears after closing the browser, and the original session cannot be found when the server is connected again. If the cookie set by the server is saved on the hard disk, or the HTTP request head sent by the browser is rewritten by some means, the original session id is sent to the server, and the browser can still find the original session after being opened again.
Just because closing the browser does not cause the session to be deleted, the server is forced to set an expiration time for the session, and when the time from the last time the session was used by the client exceeds the expiration time, the server can consider that the client has stopped the activity, and the session is deleted to save storage space.
As an embodiment, before the session synchronization, the method further includes:
when the iscoid service is started, a synchronization process for session synchronization is created;
determining an interface function of session synchronization;
scanning a session directory through an interface function;
adding the scanned session catalogue into a linked list;
traversing the linked list to read the information of the session directory and storing the information into an info structure.
Specifically, when the iscsid service starts, a process is specially for processing the synchronization of session. First, there is an entry function, which is an interface function of the synchronization process, and scans whether a session directory exists under a specified directory, if so, adds the session directory to a linked list, then traverses the linked list, reads information under each session directory, and stores the information in an info structure. And finally, executing synchronous operation on each session info.
session is not what is at the protocol level. The basic principle is that the server maintains a piece of session information data for each session, and the client and the server access the session information data by means of a globally unique identifier. When a user accesses a web application, a server program decides when to create a session, and the creation of the session can be summarized as three steps:
1. generating a globally unique identifier (session ID);
2. the data storage space is opened up. Corresponding data structures are typically created in memory, but in this case, all session data is lost upon power down of the system, which can have serious consequences in the case of e-commerce websites. However, the file can be written into the file and even stored in the database, so that the session can be durable to a certain degree although the I/O overhead is increased, and the sharing of the session is facilitated;
3. and sending the globally unique identifier of the session to the client.
The key to the problem is on how the server sends the unique identification of this session. In connection with the HTTP protocol, data may not be put in the request line, header field or Body, based on which there are generally two common ways: cookies and URLs are rewritten.
The session synchronization process provided by the embodiment of the invention enhances the robustness of the use of the iscsi client software, and when the service is abnormal, a logo failure prompt can not occur frequently; the working efficiency of the software is improved, and the working efficiency of test developers is influenced because the original function needs to wait for a period of time if the service is abnormal.
On the basis of the above embodiment, after the unlocking process is performed on the lock file corresponding to the session after the synchronization is completed, the method further includes:
deleting the lock file after unlocking and outputting log information.
Specifically, after the synchronous session processing is completed, unlocking processing is performed, namely, the content of the file lock. Write. Sid, db structure body is deleted, so that the content can be used by other session synchronization processes, and log information is output at the same time, so that a worker can conveniently check the current session synchronization condition.
As an embodiment, the optimization method of the session synchronization function includes the following steps:
step one, processing of session synchronization flow
When the iscoid service is started, a process is specially formed for processing the synchronization of the session, firstly, an entry function is provided, the function scans whether the session directory exists under a specified directory, if so, the function is added to a linked list, then the linked list is traversed, and the information under each session directory is read and stored in an info structure body. And finally, executing synchronous operation on each session info.
Step two, processing of callback interface
The callback interface sync_session truly executes the synchronization flow of the session. The session info in 1) is used for obtaining the session id, the type of the transmission protocol is obtained through the session id, the session corresponds to host no, and whether the session is created by the kernel or the user is judged, if the session is created by the kernel and is not synchronized, only the session created by the user is synchronized.
Step three, processing of locking and unlocking module
And (3) locking and unlocking information in the session info, reading the information of the session info, checking the information, and storing the information in db of the iscsi, wherein db is a structural body, locking the data of db, and creating a lock file lock. After the synchronization session processing is completed, unlocking, namely deleting the file lock.
The embodiment of the invention provides an optimization method of session synchronization function, which is characterized in that when locking processing is carried out in session (session) synchronization flow, lock files corresponding to each session are created for a plurality of sessions, different session synchronization has different lock files, each session synchronization flow is not affected, even if the lock file of the current session is not released in time, the locking processing is not affected when the next session is synchronized, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
The invention further discloses a session synchronization device corresponding to the method on the basis of the detailed description of each embodiment corresponding to the session synchronization method, and fig. 2 is a structural diagram of the session control synchronization device provided by the embodiment of the invention. As shown in fig. 2, the session synchronization apparatus includes:
an obtaining module 11, configured to obtain a plurality of sessions and corresponding data block structures, where the data block structures store information of the plurality of sessions;
a locking processing module 12, configured to perform corresponding locking processing on information of multiple sessions in the data block structure to create respective lock files;
and the unlocking processing module 13 is used for unlocking the lock file corresponding to the synchronization completion session after the synchronization completion of the session exists.
As one embodiment, the acquisition module includes:
the reading module is used for reading the information of the info structure body of the session;
the first determining module is used for checking the information of the info structure body to determine that the information of the session is legal data;
and the storage module is used for storing legal data in the data block structure.
As one embodiment, the locking processing module includes:
The creation module is used for creating corresponding session IDs for the information of the plurality of sessions, wherein the number of the session IDs is the same as that of the sessions.
As one embodiment, the unlocking module in the processing module includes:
the first acquisition module is used for acquiring the session ID through the info structure body;
the second determining module is used for determining the transmission protocol type of the session according to the session ID;
the second acquisition module is used for acquiring current host number information according to the transmission protocol type of session;
and the third determining module is used for determining the session created by the user according to the host number information so as to perform session synchronization.
As an embodiment, further comprising:
the starting module is used for creating a synchronization process of session synchronization when the iscsid service is started;
a fourth determining module, configured to determine an interface function for session synchronization;
the scanning module is used for scanning the session catalogue through the interface function;
the adding module is used for adding the scanned session catalogue into the linked list;
and the traversing module is used for traversing the linked list to read the information of the session directory and store the information into the info structure body.
As an embodiment, the third determining module includes:
the judging module is used for judging whether the host number is session created by a user, if so, entering the synchronizing module, and if not, entering the fourth determining module;
The synchronization module is used for performing session synchronization on the session created by the user;
and the fourth determining module is used for determining the session created for the kernel, and returning to the process of acquiring the current host number information according to the transmission protocol type of the session so as to acquire the next host number information.
As an embodiment, further comprising:
and the output module is used for deleting the lock file after the unlocking processing and outputting log information.
Since the embodiments of the device portion correspond to the above embodiments, the embodiments of the device portion are described with reference to the embodiments of the method portion, and are not described herein.
The method for synchronizing session control provided by the embodiment of the invention comprises the following steps: acquiring a plurality of session and a corresponding data block structure body, wherein the data block structure body stores information of the plurality of session; performing corresponding locking processing on the information of the plurality of session in the data block structure body to create respective lock files; and when the synchronization of the session is completed, unlocking the lock file corresponding to the synchronized session. When locking processing is carried out in session synchronization flow, the method creates respective corresponding lock files for a plurality of sessions, different session synchronization has different lock files, each does not affect the respective session synchronization flow, even if the lock file of the current session is not released in time, the locking processing is not affected when the next session is synchronized, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
Fig. 3 is a block diagram of another apparatus for session control synchronization according to an embodiment of the present invention, as shown in fig. 3, where the apparatus includes:
a memory 21 for storing a computer program;
a processor 22 for implementing the steps of the method of session synchronization when executing the computer program.
The session synchronization device provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, or the like.
Processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like, among others. The processor 22 may be implemented in hardware in at least one of a digital signal processor (Digital Signal Processor, DSP), a Field programmable gate array (Field-Programmable Gate Array, FPGA), a programmable logic array (Programmable Logic Array, PLA). The processor 22 may also include a main processor, which is a processor for processing data in an awake state, also referred to as a central processor (Central Processing Unit, CPU), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 22 may be integrated with an image processor (Graphics Processing Unit, GPU) for use in responsible for rendering and rendering of content required for display by the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (Artificial Intelligence, AI) processor for processing computing operations related to machine learning.
Memory 21 may include one or more computer-readable storage media, which may be non-transitory. Memory 21 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used for storing a computer program 211, where the computer program is loaded and executed by the processor 22 to implement the relevant steps of the session synchronization method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 21 may further include an operating system 212, data 213, and the like, and the storage manner may be transient storage or permanent storage. The operating system 212 may include Windows, unix, linux, among other things. The data 213 may include, but is not limited to, data related to a method of session synchronization, and the like.
In some embodiments, the session synchronization device may further include a display 23, an input/output interface 24, a communication interface 25, a power supply 26, and a communication bus 27.
It will be appreciated by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the session synchronization apparatus and may include more or less components than those illustrated.
The processor 22 implements the session synchronization method provided in any of the above embodiments by calling instructions stored in the memory 21.
The device for synchronizing session control provided by the embodiment of the invention comprises the following components: acquiring a plurality of session and a corresponding data block structure body, wherein the data block structure body stores information of the plurality of session; performing corresponding locking processing on the information of the plurality of session in the data block structure body to create respective lock files; and when the synchronization of the session is completed, unlocking the lock file corresponding to the synchronized session. When the device performs locking processing in session synchronization flow, respective corresponding lock files are created for a plurality of sessions, different session synchronization has different lock files, each does not affect the respective session synchronization flow, even if the lock file of the current session is not released in time, the locking processing is not affected when the next session is synchronized, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
Further, the present invention also provides a computer readable storage medium having a computer program stored thereon, which when executed by the processor 22 performs the steps of the method of session control synchronization as described above.
It will be appreciated that the methods of the above embodiments, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored on a computer readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium for performing all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The embodiment of the invention provides a computer medium, which comprises: acquiring a plurality of session and a corresponding data block structure body, wherein the data block structure body stores information of the plurality of session; performing corresponding locking processing on the information of the plurality of session in the data block structure body to create respective lock files; and when the synchronization of the session is completed, unlocking the lock file corresponding to the synchronized session. When the medium performs locking processing in session synchronization flow, respective corresponding lock files are created for a plurality of sessions, different session synchronization has different lock files, each session synchronization flow is not affected, even if the lock file of the current session is not released in time, the next session synchronization is not affected, and the working efficiency of software is improved. When the service is abnormal, a logo failure prompt is not frequently generated, and the probability of unlocking failure when a plurality of conversations are synchronously performed is reduced.
The method, the device and the medium for session control synchronization provided by the invention are described in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A method for session control synchronization, comprising:
acquiring a plurality of session controls and corresponding data block structures, wherein the data block structures store a plurality of session control information;
performing corresponding locking processing on a plurality of session control information in the data block structure body to create respective lock files;
and when the session control is synchronous, unlocking the lock file corresponding to the synchronous session control.
2. The method of session control synchronization according to claim 1, wherein acquiring the data block structure of the session control comprises:
reading information of the structure body of the session control;
checking the information of the structural body to determine that the information of the session control is legal data;
storing the legal data in the data block structure.
3. The method of claim 2, wherein said performing a corresponding locking process on a plurality of said session control information within said data block structure to create respective lock files comprises:
creating corresponding session control identification numbers for the information of the plurality of session controls, wherein the session control identification numbers are the same as the session controls in number.
4. A method of session control synchronization according to claim 3, characterized in that the session control synchronization procedure comprises:
acquiring the session control identification number through the structural body;
determining the transmission protocol type of the session control according to the session control identification number;
acquiring current host number information according to the transmission protocol type of the session control;
and determining session control created by a user according to the host number information so as to synchronize the session control.
5. The method of session control synchronization according to claim 4, further comprising, prior to the session control synchronization:
when the Internet small computer system interface service is started, a synchronous process of the session control synchronization is established;
determining an interface function of the session control synchronization;
scanning a session control directory through the interface function;
adding the scanned session control catalogue into a linked list;
traversing the linked list to read the information of the session control directory and store the information into the structure body.
6. The method of claim 4, wherein said determining a user-created session control based on said host number information comprises:
Judging whether the host number is session control created by the user;
if yes, synchronizing the session control established by the user;
if not, determining the session control created for the kernel, and returning to the process of acquiring the current host number information according to the transmission protocol type of the session control to acquire the next host number information.
7. The method for synchronizing session control according to any one of claims 1 to 6, further comprising, after the unlocking process is performed on the lock file corresponding to the session control for which synchronization is completed:
deleting the lock file after unlocking and outputting log information.
8. An apparatus for session control synchronization, comprising:
the system comprises an acquisition module, a data block storage module and a data block storage module, wherein the acquisition module is used for acquiring a plurality of session controls and corresponding data block structures, and the data block structures store a plurality of session control information;
the locking processing module is used for carrying out corresponding locking processing on the information of the session control in the data block structure body so as to create respective lock files;
and the unlocking processing module is used for unlocking the lock file corresponding to the session control after the session control is synchronized.
9. An apparatus for session control synchronization, comprising:
a memory for storing a computer program;
processor for implementing the steps of the method of session control synchronization according to any of claims 1 to 7 when executing said computer program.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method of session control synchronization according to any of claims 1 to 7.
CN202310418685.0A 2023-04-14 2023-04-14 Method, device and medium for session control synchronization Pending CN116382930A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310418685.0A CN116382930A (en) 2023-04-14 2023-04-14 Method, device and medium for session control synchronization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310418685.0A CN116382930A (en) 2023-04-14 2023-04-14 Method, device and medium for session control synchronization

Publications (1)

Publication Number Publication Date
CN116382930A true CN116382930A (en) 2023-07-04

Family

ID=86973165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310418685.0A Pending CN116382930A (en) 2023-04-14 2023-04-14 Method, device and medium for session control synchronization

Country Status (1)

Country Link
CN (1) CN116382930A (en)

Similar Documents

Publication Publication Date Title
US11019144B2 (en) Collaborative cloud-based document editing from a browser-enabled platform native application
WO2021218328A1 (en) Multi-tenant access service implementation method, apparatus and device, and storage medium
US6341352B1 (en) Method for changing a security policy during processing of a transaction request
US6233617B1 (en) Determining the visibility to a remote database client
AU781898B2 (en) Method for acquiring content information, and software product, collaboration system and collaboration server for acquiring content information
US8924592B2 (en) Synchronization of server-side cookies with client-side cookies
US5764887A (en) System and method for supporting distributed computing mechanisms in a local area network server environment
US7925751B1 (en) Mechanism for controlled sharing of files in a clustered application environment
US20050234936A1 (en) Asynchronous database API
US20130339533A1 (en) Virtual session management and reestablishment
WO2021013033A1 (en) File operation method, apparatus, device, and system, and computer readable storage medium
CN110597825B (en) Data processing method and device based on block chain and node equipment
CN110298162A (en) Application client login method, device, computer equipment and storage medium
CN110764871A (en) Cloud platform-based mimicry application packaging and control system and method
CN108234122B (en) Token checking method and device
US11431809B1 (en) Session data isolation and management
CN116382930A (en) Method, device and medium for session control synchronization
CN112836186A (en) Page control method and device
US20090183255A1 (en) Server services on client for disconnected authentication
JP6205013B1 (en) Application usage system
CA2624272A1 (en) Productivity suite to line of business synchronization mechanism
CN114048443A (en) User identity verification method and device and computer storage medium
KR20180132398A (en) Method and program for storing service data by cloud account
CN112817997A (en) Method and device for accessing S3 object storage by using dynamic user through distributed computing engine
CN111385358B (en) Synchronization method and device of session control object and server

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